GIT – Continuing with the mini posts I ran into this error today while setting up our redundancy servers. I moved the directory out of it’s default location of /var/lib. So when I went to start it would fail. When I looked in the /var/log/mysqld.log I seen the following:

Fatal error: Can’t open and lock privilege tables: Table ‘mysql.host’ doesn’t exist

To fix this issue you simply just have to tell mysql where to look not that the default installation is moved. You can do that with:

mysql_install_db –user=mysql –ldata=/newlocation

once you do that you can restart mysql

/etc/init.d/mysqld restart

Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

I’m getting the following error when I run mysql -u root -p

Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (2)

How do I solve this problem under / RHEL / Red Hat Enterprise server 5.x or 6.x?

To solve this problem take the following steps.

Is MySQL Running?

Type the following command
# service mysqld status
If mysqld is not running, start it:
# service mysqld start
Try mysql command again as follows:
$ mysql -u USER -p

Is MySQL Installed?

Make sure the package mysql-server is installed:
# rpm -qa mysql-server
Sample outputs:

mysql-server-5.1.61-4.el6.x86_64

If you do not see package name, type the following command to install mysql-server:
# yum install mysql-server
Turn on mysqld to start automatically on boot:
# chkconfig mysqld on
Run mysqld service, enter:
# service mysqld start
Set a new root password for mysql server:
# mysqladmin -u root password 'MySQL-Root-User-Password'

Connect MySQL by Socket

mysql –socket=/var/lib/mysql/mysql.sock
Print Friendly

Comments

comments

Bài viết liên quan