Problem Description:
When installing mysql,/etc/init.d/mysqld start reported an error:
[root@master data]# /etc/init.d/mysqld start
Starting MySQL.. ERROR! The server quit without updating PID file (/var/lib/mysql/master.pid).
Solution steps:
1. Check the script when installing MySQL and the specified file
2. Check mariadb.log to find related errors:
[ root@master init.d]# cd /var/log/mariadb
[ root@master mariadb]# ls
mariadb.log
The specific error is: [error] fatal error: can’t open and lock privilege tables: table ‘mysql. User’ doesn’t exist. Here is a description of the error and its solution
#View the current my.cnf configuration file
[root@master mariadb]# more /etc/my.cnf |grep -v ^#
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
!includedir /etc/my.cnf.d
#Because the path specified during compilation and installation is/MNT/MySQL/data and mysql_ install_ The dataDir specified in DB is also/MNT/MySQL/data:
/usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/mnt/mysql/data --user=mysql
The path specified by my.cnf is
/var/lib/mysql
#So modify the dataDir to the correct path:
[root@master mariadb]# more /etc/my.cnf |grep -v ^#
[mysqld]
datadir=/mnt/mysql/data
socket=/var/lib/mysql/mysql.sock
symbolic-links=0
[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid
!includedir /etc/my.cnf.d
[root@master mariadb]# service mysqld start
Starting MySQL. SUCCESS!
Similar Posts:
- [Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
- Failed to find valid data directory.Data Dictionary initialization failed.
- Can’t open and lock privilege tables: Table ‘mysql.user’ doesn’t exist
- Solution to the error of MySQL: unrecognized service (CentOS)
- MySQL Use innobackupex to backup and recovery error [How to Solve]
- MYSQL Startup Error: [ERROR] Aria engine is not enabled or did not start. The Aria engine must be enabled to
- [Solved] MySQL Restart Error: Another MySQL daemon already running with the same UNIX socket
- How to Solve MySQL Startup error: mysql-bin.index not found (Errcode: 13)
- MySQL Error: The server quit without updating PID file [How to Solve]
- Job for mysqld.service failed because the control process exited with error code