In this recipe, we will look at some common problems with MySQL and learn how to solve them.
You will need access to a root account or an account with sudo
privileges.
You will need administrative privileges on the MySQL server.
Follow these steps to troubleshoot MySQL:
$ sudo service mysql status $ sudo netstat -pltn
/var/log/mysql.log
and mysql.err
.verbose
flag set:$ which mysqld /usr/sbin/mysqld $ sudo /usr/sbin/mysqld --user=mysql --verbose
listen
on a public port. Check for bind-address
in my.cnf
:bind-address = 10.0.247.168
mysql> select user, host, password from mysql.user where user = ‘username’;
mysql > grant all privileges on databasename.* to ‘username’@’%’;
mysql server has gone away
, then increase wait_timeout
in the configuration file. Alternatively, you can re-initiate a connection on the client side after a specific timeout.repair table
statement to recover the crashed MyISAM table:$ mysql -u root -p mysql> repair table databasename.tablename;
mysqlcheck
command to repair tables:$ mysqlcheck -u root -p --auto-repair --check --optimize databasename