This question already has answers here:
mysqli_real_connect(): (HY000/2002): No such file or directory
(19 answers)
Closed 5 months ago.
I get this error when I try to login in phpmyadmin: "mysqli_real_connect(): no such file or directory"
My os is ubuntu
What should I do?
I even do this
"change localhost to 127.0.0.1 in config.inc.php"
but it doesn't work
this is the status of MySQL service
`sudo service mysql status`
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: en)
Active: failed (Result: exit-code) since Sat 2018-05-19 08:54:24 CST; 2min 4s
Process: 31984 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exi
Main PID: 1244 (code=exited, status=0/SUCCESS)
مه 19 08:54:24 amir systemd[1]: mysql.service: Service hold-off time over, sched
مه 19 08:54:24 amir systemd[1]: mysql.service: Scheduled restart job, restart co
مه 19 08:54:24 amir systemd[1]: Stopped MySQL Community Server.
مه 19 08:54:24 amir systemd[1]: mysql.service: Start request repeated too quickl
مه 19 08:54:24 amir systemd[1]: mysql.service: Failed with result 'exit-code'.
مه 19 08:54:24 amir systemd[1]: Failed to start MySQL Community Server.
Seen that you changed in config.inc.php:
localhost to 127.0.0.1
Well you could try not doing it by just adding the port-number where the mysql runs like in the example below:
$cfg['Servers'][$i]['host'] = 'localhost:3306';
Actually, I too had same problem and tried as you did which is ultimately answered everywhere in different forums.
Finally, I tried the above and worked for me. hopefully, it does work for you as well.
Good luck!
Related
I just tried to update the PHP Version of the nginx server and I get this message, when I enter systemctl status php7.4-fpm.service
php7.4-fpm.service - The PHP 7.4 FastCGI Process Manager
Loaded: loaded (/lib/systemd/system/php7.4-fpm.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Mon 2020-12-14 20:11:31 UTC; 4min 50s ago
Docs: man:php-fpm7.4(8)
Process: 9196 ExecStopPost=/usr/lib/php/php-fpm-socket-helper remove /run/php/php-fpm.sock /etc/php/7.4/fpm/pool.d/www.conf 74 (code=exited, status=0/SUCCESS)
Process: 9178 ExecStart=/usr/sbin/php-fpm7.4 --nodaemonize --fpm-config /etc/php/7.4/fpm/php-fpm.conf (code=exited, status=78)
Main PID: 9178 (code=exited, status=78)
Dec 14 20:11:31 vultr.guest systemd[1]: Starting The PHP 7.4 FastCGI Process Manager...
Dec 14 20:11:31 vultr.guest php-fpm7.4[9178]: [14-Dec-2020 20:11:31] ERROR: unable to bind listening socket for address '127.0.0.1:9000': Address already in use (98)
Dec 14 20:11:31 vultr.guest php-fpm7.4[9178]: [14-Dec-2020 20:11:31] ERROR: FPM initialization failed
Dec 14 20:11:31 vultr.guest systemd[1]: php7.4-fpm.service: Main process exited, code=exited, status=78/n/a
Dec 14 20:11:31 vultr.guest systemd[1]: php7.4-fpm.service: Failed with result 'exit-code'.
Dec 14 20:11:31 vultr.guest systemd[1]: Failed to start The PHP 7.4 FastCGI Process Manager.
Also if I check for the Version with php -v I get back the Version 7.4.13
However, if upload a test.php File with just <?php phpinfo();?> in it, the Server tells me that I still run on PHP Version 7.3.22-1+ubuntu18.04.1+deb.sury.org+1
Already tried to change the standard PHP version with sudo update-alternatives --set php /usr/bin/php7.4
Thanks for your help
I want use postgresql but show error so checking status. it's failed.
once I deleted postmaster but same error happen.
This server is worked before [yum install --enablerepo=remi-php72 php-pdo php-pgsql] and some operation but i don't know this is reason or not.
$sudo systemctl start postgresql-12.service
Job for postgresql-12.service failed because the control process exited with error code. See "systemctl status postgresql-12.service" and "journalctl -xe" for details.
$systemctl status postgresql-12.service
● postgresql-12.service - PostgreSQL 12 database server
Loaded: loaded (/usr/lib/systemd/system/postgresql-12.service; enabled; ver preset: disabled)
Active: failed (Result: exit-code) since Sun 2020-05-10 05:17:14 UTC; 40s
Docs: https://www.postgresql.org/docs/12/static/
Process: 708 ExecStart=/usr/pgsql-12/bin/postmaster -D ${PGDATA} (code=exit status=1/FAILURE)
Process: 699 ExecStartPre=/usr/pgsql-12/bin/postgresql-12-check-db-dir ${PGA} (code=exited, status=0/SUCCESS)
Main PID: 708 (code=exited, status=1/FAILURE)
-- Unit postgresql-12.service has begun starting up.
May 10 06:30:15 localhost.localdomain postmaster[3481]: 2020-05-10 06:30:15.915 UTC [3481] LOG: starting PostgreSQL 12.2 on x86_64-pc-linux-gnu, compiled by
May 10 06:30:15 localhost.localdomain postmaster[3481]: 2020-05-10 06:30:15.922 UTC [3481] LOG: listening on IPv6 address "::1", port 5432
May 10 06:30:15 localhost.localdomain postmaster[3481]: 2020-05-10 06:30:15.922 UTC [3481] LOG: listening on IPv4 address "127.0.0.1", port 5432
May 10 06:30:15 localhost.localdomain postmaster[3481]: 2020-05-10 06:30:15.925 UTC [3481] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
May 10 06:30:15 localhost.localdomain postmaster[3481]: 2020-05-10 06:30:15.929 UTC [3481] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
May 10 06:30:16 localhost.localdomain postmaster[3481]: 2020-05-10 06:30:16.000 UTC [3481] LOG: redirecting log output to logging collector process
May 10 06:30:16 localhost.localdomain postmaster[3481]: 2020-05-10 06:30:16.000 UTC [3481] HINT: Future log output will appear in directory "log".
May 10 06:30:16 localhost.localdomain systemd[1]: postgresql-12.service: main process exited, code=exited, status=1/FAILURE
May 10 06:30:16 localhost.localdomain systemd[1]: Failed to start PostgreSQL 12 database server.
-- Subject: Unit postgresql-12.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit postgresql-12.service has failed.
--
-- The result is failed.
May 10 06:30:16 localhost.localdomain systemd[1]: Unit postgresql-12.service entered failed state.
May 10 06:30:16 localhost.localdomain systemd[1]: postgresql-12.service failed.
May 10 06:30:16 localhost.localdomain sudo[3468]: pam_unix(sudo:session): session closed for user root
May 10 06:30:16 localhost.localdomain polkitd[393]: Unregistered Authentication Agent for unix-process:3470:439245 (system bus name :1.64, object path /org/f
when I do this and secure(file) in log directory was updated like this.
but i have no idea what i have to do this detail.
$ systemctl start postgresql-12.service
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to manage system services or units.
Authenticating as: root
Password:
==== AUTHENTICATION COMPLETE ===
Job for postgresql-12.service failed because the control process exited with error code. See "systemctl status postgresql-12.service" and "journalctl -xe" for details.
May 10 08:01:06 localhost polkitd[382]: Registered Authentication Agent for unix-process:3289:174171 (system bus name :1.71 [/usr/bin/pkttyagent --notify-fd 5 --fallback], object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8)
May 10 08:01:09 localhost polkitd[382]: Operator of unix-process:3289:174171 successfully authenticated as unix-user:root to gain ONE-SHOT authorization for action org.freedesktop.systemd1.manage-units for system-bus-name::1.72 [systemctl start postgresql-12.service] (owned by unix-user:vagrant)
May 10 08:01:09 localhost polkitd[382]: Unregistered Authentication Agent for unix-process:3289:174171 (system bus name :1.71, object path /org/freedesktop/PolicyKit1/AuthenticationAgent, locale en_US.UTF-8) (disconnected from bus)
postgresql-Sun.log
2020-05-10 05:04:35.435 UTC [3207] LOG: could not connect to Ident server at address "127.0.0.1", port 113: Connection refused
2020-05-10 05:04:35.435 UTC [3207] FATAL: Ident authentication failed for user "postgres"
2020-05-10 05:04:35.435 UTC [3207] DETAIL: Connection matched pg_hba.conf line 82: "host all all 127.0.0.1/32
I resolved !
I was aninstalled postgresql before post this question but I didn't update /var/lib/pgsql/12 file so I removed that by using
sudo rm -rf /var/lib/pgsql/12
and create by
sudo PGSETUP_INITDB_OPTIONS="-E UTF --locale=C"/usr/pgsql-12/bin/postgresql-12-setup initdb
fine!
Same error with postgres-14
I solved like this:
sudo rm -rf /var/lib/pgsql/14
sudo /usr/pgsql-14/bin/postgresql-14-setup initdb
sudo systemctl start postgresql-14
sudo systemctl enable postgresql-14 (create symlink)
I hope to help someone,
Bye!!
I have made a Wordpress website first hosted locally with local by Flywheel.
I am trying to fully self-host it with a personal server (running ubuntu 18.04), not using some online ftp. I have found no documentation online about the way to do it, only people trying to sell theirs ftp services with a ready-to-use Wordpress environment... I managed to install some things, and when I enter the static IP address of the website, it works!
The problem:
After some time, a message like this appears : Error while trying to connect to the database and the website is down.
If I run /etc/init.d/mysql start again, the website works again! 30 min later, it breaks again, displaying the message above...
This is what I have done:
I used Duplicator to made an image of the website, and transferred it to the server.
I have installed:
nginx (for reverse proxy)
php 7.2
mysql-server
mysql-client
php7.2-mysql and some other extensions
My logins in wp-config.php are correct
Can you help me please ?
Things that failed:
restarting the server and reinstall everything
sudo systemctl reload mysql
Failed to reload mysql.service: Job type reload is not applicable for unit mysql.service.
See system logs and 'systemctl status mysql.service' for details.
sudo systemctl force-reload mysql
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
systemctl status mysql.service
mysql.service - MySQL Community Server
Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2020-04-22 10:07:23 UTC; 24min ago
Process: 10681 ExecStart=/usr/sbin/mysqld —daemonize —pid-file=/run/mysqld/mysqld.pid (code=exited, status=1/FAILURE)
Process: 10659 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
Main PID: 10433 (code=exited, status=0/SUCCESS)
Apr 22 10:07:23 ewenvm systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 22 10:07:23 ewenvm systemd[1]: Failed to start MySQL Community Server.
Apr 22 10:07:23 ewenvm systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Apr 22 10:07:23 ewenvm systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
Apr 22 10:07:23 ewenvm systemd[1]: Stopped MySQL Community Server.
Apr 22 10:07:23 ewenvm systemd[1]: mysql.service: Start request repeated too quickly.
Apr 22 10:07:23 ewenvm systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 22 10:07:23 ewenvm systemd[1]: Failed to start MySQL Community Server.
journalctl -xe
— Support: http://www.ubuntu.com/support
—
— Unit mysql.service has failed.
—
— The result is RESULT.
Apr 22 10:07:23 name-of-my-server systemd[1]: mysql.service: Service hold-off time over, scheduling restart.
Apr 22 10:07:23 name-of-my-server systemd[1]: mysql.service: Scheduled restart job, restart counter is at 5.
— Subject: Automatic restarting of a unit has been scheduled
— Defined-By: systemd
— Support: http://www.ubuntu.com/support
—
— Automatic restarting of the unit mysql.service has been scheduled, as the result for
— the configured Restart= setting for the unit.
Apr 22 10:07:23 name-of-my-server systemd[1]: Stopped MySQL Community Server.
— Subject: Unit mysql.service has finished shutting down
— Defined-By: systemd
— Support: http://www.ubuntu.com/support
—
— Unit mysql.service has finished shutting down.
Apr 22 10:07:23 name-of-my-server systemd[1]: mysql.service: Start request repeated too quickly.
Apr 22 10:07:23 name-of-my-server systemd[1]: mysql.service: Failed with result 'exit-code'.
Apr 22 10:07:23 name-of-my-server systemd[1]: Failed to start MySQL Community Server.
— Subject: Unit mysql.service has failed
— Defined-By: systemd
— Support: http://www.ubuntu.com/support
—
— Unit mysql.service has failed.
—
— The result is RESULT.
Apr 22 10:09:01 name-of-my-server CRON[10701]: pam_unix(cron:session): session opened for user root by (uid=0)
Apr 22 10:09:01 name-of-my-server CRON[10702]: (root) CMD ( [ -x /usr/lib/php/sessionclean ] && if [ ! -d /run/systemd/system ]; then /usr/lib/php/sessionclean; fi)
Apr 22 10:09:01 name-of-my-server CRON[10701]: pam_unix(cron:session): session closed for user root
Apr 22 10:09:03 name-of-my-server systemd[1]: Starting Clean php session files...
— Subject: Unit phpsessionclean.service has begun start-up
— Defined-By: systemd
— Support: http://www.ubuntu.com/support
—
— Unit phpsessionclean.service has begun starting up.
Apr 22 10:09:04 name-of-my-server systemd[1]: Started Clean php session files.
— Subject: Unit phpsessionclean.service has finished start-up
— Defined-By: systemd
— Support: http://www.ubuntu.com/support
—
— Unit phpsessionclean.service has finished starting up.
—
— The start-up result is RESULT.
Apr 22 10:13:11 name-of-my-server sshd[10770]: Did not receive identification string from 182.182.22.159 port 52155
Apr 22 10:15:31 name-of-my-server systemd-timesyncd[2721]: Timed out waiting for reply from 91.189.89.199:123 (ntp.ubuntu.com).
Apr 22 10:15:41 name-of-my-server systemd-timesyncd[2721]: Timed out waiting for reply from 91.189.89.198:123 (ntp.ubuntu.com).
Apr 22 10:15:51 name-of-my-server systemd-timesyncd[2721]: Timed out waiting for reply from 91.189.91.157:123 (ntp.ubuntu.com).
Apr 22 10:16:01 name-of-my-server systemd-timesyncd[2721]: Timed out waiting for reply from 91.189.94.4:123 (ntp.ubuntu.com).
Apr 22 10:17:01 name-of-my-server CRON[10779]: pam_unix(cron:session): session opened for user root by (uid=0)
Apr 22 10:17:01 name-of-my-server CRON[10780]: (root) CMD ( cd / && run-parts —report /etc/cron.hourly)
Apr 22 10:17:01 name-of-my-server CRON[10779]: pam_unix(cron:session): session closed for user root
Here are the logs in /var/log/mysql/error/log :
2020-04-22T09:46:51.409203Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use —explicit_defaults_for_timestamp server option (see documentation for more details).
2020-04-22T09:46:51.413886Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.29-0ubuntu0.18.04.1) starting as process 10312 ...
2020-04-22T09:46:51.480012Z 0 [Note] InnoDB: PUNCH HOLE support available
2020-04-22T09:46:51.480056Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-04-22T09:46:51.480062Z 0 [Note] InnoDB: Uses event mutexes
2020-04-22T09:46:51.480079Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2020-04-22T09:46:51.480086Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-04-22T09:46:51.480091Z 0 [Note] InnoDB: Using Linux native AIO
2020-04-22T09:46:51.480890Z 0 [Note] InnoDB: Number of pools: 1
2020-04-22T09:46:51.481899Z 0 [Note] InnoDB: Using CPU crc32 instructions
2020-04-22T09:46:51.487169Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2020-04-22T09:46:51.490733Z 0 [ERROR] InnoDB: mmap(137428992 bytes) failed; errno 12
2020-04-22T09:46:51.490760Z 0 [ERROR] InnoDB: Cannot allocate memory for the buffer pool
2020-04-22T09:46:51.490768Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2020-04-22T09:46:51.490778Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-04-22T09:46:51.492322Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-04-22T09:46:51.492337Z 0 [ERROR] Failed to initialize builtin plugins.
2020-04-22T09:46:51.492342Z 0 [ERROR] Aborting
2020-04-22T09:46:51.494236Z 0 [Note] Binlog end
2020-04-22T09:46:51.495643Z 0 [Note] Shutting down plugin 'CSV'
2020-04-22T09:46:51.508165Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
This is strange. MySQL installed on Ubuntu with sudo apt install mysql-server is usually bulletproof.
As I read your error logs, this is the root-cause of your failures.
2020-04-22T09:46:51.490733Z 0 [ERROR] InnoDB: mmap(137 428 992 bytes) failed; errno 12
When MySQL, specifically the InnoDB "access method", was starting, it could not map 137 some-odd megabytes of memory to a file in the file system.
Do you have enough RAM on your Ubuntu instance? Is the disk or SSD almost full? If you have a separate disk partition for your /tmp directory is it big enough? (Avoid RAMDISK for /tmp when you're running MySQL.) Does it have other heavy applications running on it?
If this were my project and I was working with a VM, I would erase it and start over at this point.
I'm a big fan of Digital Ocean's step by step tutorials. I know they're a server-rental company, but their tutorials work for local installs too. https://www.digitalocean.com/community/tutorials/how-to-install-wordpress-with-lamp-on-ubuntu-18-04
I have upgraded my PHP from version 5.6 to 7.2 and now MySQL does not work. When I enter sudo service mysqsl start, the following text gets displayed:
Job for mysql.service failed because the control process exited with error code.
See "systemctl status mysql.service" and "journalctl -xe" for details.
output of journalctl -xe
output of systemctl status mysql.service:
mysql.service - LSB: Start and stop the mysql database server daemon
Loaded: loaded (/etc/init.d/mysql)
Active: failed (Result: exit-code) since \u0633\u0647\u200c\u0634\u0646\u0628\u0647 2018-07-17 04:22:01 +0430; 27s ago
Docs: man:systemd-sysv-generator(8)
Process: 26938 ExecStop=/etc/init.d/mysql stop (code=exited, status=0/SUCCESS)
Process: 6860 ExecStart=/etc/init.d/mysql start (code=exited, status=1/FAILURE)
Main PID: 9974 (code=exited, status=0/SUCCESS)
\u0698\u0648\u0626\u06cc\u0647 17 04:22:01 hutadmin-virtual-machine mysql[6860]: [97B blob data]
\u0698\u0648\u0626\u06cc\u0647 17 04:22:01 hutadmin-virtual-machine mysql[6860]: Fatal error in defaults handling. Program aborted
\u0698\u0648\u0626\u06cc\u0647 17 04:22:01 hutadmin-virtual-machine /etc/init.d/mysql[7565]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
\u0698\u0648\u0626\u06cc\u0647 17 04:22:01 hutadmin-virtual-machine /etc/init.d/mysql[7565]: [61B blob data]
\u0698\u0648\u0626\u06cc\u0647 17 04:22:01 hutadmin-virtual-machine /etc/init.d/mysql[7565]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
\u0698\u0648\u0626\u06cc\u0647 17 04:22:01 hutadmin-virtual-machine mysql[6860]: ...fail!
\u0698\u0648\u0626\u06cc\u0647 17 04:22:01 hutadmin-virtual-machine systemd[1]: mysql.service: Control process exited, code=exited status=1
\u0698\u0648\u0626\u06cc\u0647 17 04:22:01 hutadmin-virtual-machine systemd[1]: Failed to start LSB: Start and stop the mysql database server daemon.
\u0698\u0648\u0626\u06cc\u0647 17 04:22:01 hutadmin-virtual-machine systemd[1]: mysql.service: Unit entered failed state.
\u0698\u0648\u0626\u06cc\u0647 17 04:22:01 hutadmin-virtual-machine systemd[1]: mysql.service: Failed with result 'exit-code'.
How can I fix this problem? I need to start MySQL.
I am attempting to use pthreads with Apache FPM.
Step 1.
After installing and recompiling php according to:
https://blog.programster.org/ubuntu16-04-compile-php-7-2-with-pthreads
The server works as expected and I can run pthreads from CLI.
Step 2.
Then I need to run threads from a web server so I followed the instructions from:
https://antrecu.com/blog/run-php7-fpm-apache-mpmevent-ubuntu-1604
After sudo service apache2 restart && sudo service php7.0-fpm restart:
Job for apache2.service failed because the control process exited with error code.
See "systemctl status apache2.service" and "journalctl -xe" for details.
$ systemctl status apache2.service
apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
└─apache2-systemd.conf
Active: failed (Result: exit-code) since Mon 2018-03-12 17:09:45 PDT; 3min 35s ago
Docs: man:systemd-sysv-generator(8)
Process: 30818 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 32443 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
Mar 12 17:09:45 ubuntu apache2[32443]: * The apache2 configtest failed.
Mar 12 17:09:45 ubuntu apache2[32443]: Output of config test was:
Mar 12 17:09:45 ubuntu apache2[32443]: [Mon Mar 12 17:09:45.084452 2018] [:crit] [pid 32454:tid 139629110323072]
Apache is running a threaded MPM, but your PHP Module is not compiled to be threadsafe. You n.. (output cut off in SSH client)
Mar 12 17:09:45 ubuntu apache2[32443]: AH00013: Pre-configuration failed
Mar 12 17:09:45 ubuntu apache2[32443]: Action 'configtest' failed.
Mar 12 17:09:45 ubuntu apache2[32443]: The Apache error log may have more information.
Mar 12 17:09:45 ubuntu systemd[1]: apache2.service: Control process exited, code=exited status=1
Mar 12 17:09:45 ubuntu systemd[1]: Failed to start LSB: Apache2 web server.
Mar 12 17:09:45 ubuntu systemd[1]: apache2.service: Unit entered failed state.
Needless to say I am a newbie when it comes to compiling Linux packages.
Any suggestions?
I am attempting to use pthreads with Apache FPM.
You can't. Find a way to work without them.
The pthreads extension cannot be used in a web server environment. Threading in PHP is therefore restricted to CLI-based applications only.
-- http://php.net/manual/en/intro.pthreads.php