问题
/usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/conf/my.cnf --user=mysql
该命令启动mysql时,未启动成功,终端输出下列报错:
2024-02-03T02:56:51.449040Z mysqld_safe Logging to '/usr/local/mysql/mysqllog/logfile/mysql-err.log'.
2024-02-03T02:56:51.499886Z mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
/usr/local/mysql/bin/mysqld_safe: line 199: 22709 Killed env MYSQLD_PARENT_PID=22426 nohup /usr/local/mysql/bin/mysqld --defaults-file=/usr/local/mysql/conf/my.cnf --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/mysqllog/logfile/mysql-err.log --pid-file=/usr/local/mysql/data/mysql.pid --socket=/usr/local/mysql/mysql.sock --port=1564 < /dev/null > /dev/null 2>&1
2024-02-03T03:03:57.244834Z mysqld_safe mysqld from pid file /usr/local/mysql/data/mysql.pid ended
解决
pid文件是mysql启动后,生成的一个文件,里面记录的是mysql当前的进程号,如果创建失败,mysql就无法启动。
问题的原因是没有成功生成pid文件,新建一个/usr/local/mysql/data/mysql.pid即可
touch /usr/local/mysql/data/mysql.pid
参考:https://blog.csdn.net/GX_1_11_real/article/details/93010284
标签:--,pid,mysqld,usr,mysql,local From: https://www.cnblogs.com/nancywsn/p/18005106