Reputation: 1214
I noticed this issue when my Wordpress server started throwing aa MySQL error. To try to debug Wordpress, I attempted to connect manually.
I get the following:
$ mysql -u root -p -h localhost -P 3306
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)
I've also tried no -h option and 127.0.0.1
It looks like MySQL is running.
$ ps -ef | grep mysql
mysql 14743 1 0 15:20 ? 00:00:00 /usr/sbin/mysqld
bitnami 14939 13882 0 15:28 pts/0 00:00:00 grep --color=auto
mysql-server is installed, but /opt/bitnami/mysql/tmp/mysql.sock
does not exist.
It looks like MySQL is listening on the correct port.
$ telnet 127.0.0.1 3306
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
[
5.5.54-0ubuntu0.14.04.1,IIq{;Rh�k>5/)"m"[&J#mysql_native_password
!#08S01Got packets out of orderConnection closed by foreign host.
Following the suggestion here:
$ sudo /opt/bitnami/ctlscript.sh status
php-fpm already running
apache already running
mysql not running
$ sudo /opt/bitnami/ctlscript.sh start mysql
2017-02-14T16:53:25.064586Z mysqld_safe Logging to '/opt/bitnami/mysql/data/mysqld.log'.
2017-02-14T16:53:25.233250Z mysqld_safe Starting mysqld.bin daemon with databases from /opt/bitnami/mysql/data
2017-02-14T16:53:28.400598Z mysqld_safe mysqld from pid file /opt/bitnami/mysql/data/mysqld.pid ended
/opt/bitnami/mysql/scripts/ctl.sh : mysql could not be started
Monitored mysql
Here are a few choice lines from /opt/bitnami/mysql/data/mysqld.log. It looks like theres a conflict.
2017-02-14T17:03:31.274720Z 0 [Note] Server hostname (bind-address): '127.0.0.1'; port: 3306
2017-02-14T17:03:31.274778Z 0 [Note] - '127.0.0.1' resolves to '127.0.0.1';
2017-02-14T17:03:31.274835Z 0 [Note] Server socket created on IP: '127.0.0.1'.
2017-02-14T17:03:31.274888Z 0 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
2017-02-14T17:03:31.274901Z 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2017-02-14T17:03:31.274952Z 0 [ERROR] Aborting
Upvotes: 3
Views: 11544
Reputation: 1722
Sometimes, all you need is a restart. Try the following.
sudo opt/bitnami/ctlscript.sh stop
Followed by
sudo opt/bitnami/ctlscript.sh start
You can also do a restart but I have had instances where restarts have not worked but stopping and starting have worked.
Upvotes: 0
Reputation: 16307
Before doing anything first check space. Make sure it is not used 100%
df -h
If space is available.
For Chcecking Mysql is running or not.
ps xufa | grep mysql
Restart mysql
sudo service bitnami restart mysql
Upvotes: 5
Reputation: 151
The issue is that you already have a mysql server running which is not the bitnami one. You should stop that service first before start the mysql server from bitnami.
You can try to stop with:
$ sudo service mysql stop
If it doesn't work you can kill the process:
$ sudo kill 14743
And finally start the bitnami mysql server with this command:
$ sudo /opt/bitnami/ctlscript.sh start mysql
After this server is running you should be able to connect without problems.
Upvotes: 3