Tips:
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]
Checked MySQL log (cat/var/log/mysqld.log) found prompt for an error ([ERROR] Fatal Error:can ' t open and Lock privilege tables:table ' Mysql.host ' doesn ' t exist), as shown in figure:
Speculation may be MySQL's default database is not installed normally, but uninstall MySQL (yum remove mysql-server) reload (yum install mysql-server) or not, the phenomenon is the same as the original. Later, we found a command to install the default database specifically: mysql_install_db, after the execution, and then start MySQL (/etc/init.d/mysqld start) finally see a long absence of OK:
The code is as follows |
Copy Code |
#/etc/init.d/mysqld Start Starting MySQL: [OK] |
Question Two
When started with the SAFE_MYSQLDQ, it appears
Fatal Error:can ' t open and Lock Privilege tables:table ' mysql.host ' doesn ' t exist
The final solution is as follows:
Under the MySQL installation directory, mine is/usr/local/mysql.
The code is as follows |
Copy Code |
./scripts/mysql_install_db--usrer=mysql--datadir=/usr/local/mysql/data/ |
The reason is that the data directory inconsistency caused by the reload
Question Three
Tell me about the process I solved:
Follow the MySQL installation steps:
code is as follows |
copy code |
shell> Groupadd MySQL shell> useradd-g mysql mysql shell> gunzip < mysql-version.tar.gz | tar-xvf- She ll> CD mysql-version shell>./configure--prefix=/usr/local/mysql shell> make shell> make Insta ll shell> scripts/mysql_install_db--user=mysql shell> chown-r root/usr/local/mysql shell> chown -R mysql/usr/local/mysql/var shell> chgrp-r mysql/usr/local/mysql shell> CP support-files/my-medium.cn F/ETC/MY.CNF shell>/usr/local/mysql/bin/mysqld_safe--user=mysql & |
There is no problem with this standard, but when I start MySQL in the final step I want to put the data files of the database under another directory, and the start command is modified to:
The code is as follows |
Copy Code |
Shell>/usr/local/mysql/bin/mysqld_safe--user=mysql--log-error=/u01/mysql/mysql_error/error--datadir=/u01/ Mysql/data |
There is a problem at this time, because the default created permission table is below the default directory/usr/local/mysql/var when you initialize the Database permission table, which causes the above error to not find the permission table: Can ' t open and lock Privilege tables:table ' mysql.host ' doesn ' t exist
Workaround use the Add parameter--datadir when running the initialization permission table, the command format is:
The code is as follows |
Copy Code |
shell> scripts/mysql_install_db--user=mysql--datadir=/u01/mysql/data |