Errors during MySQL installation
1. Error reporting
[root@zs data]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &[1] 3758
[root@zs data]# 170720 14:41:24 mysqld_safe Logging to '/data/mysql/error.log'.
201207 14:41:24 mysqld_safe Starting mysqld daemon with databases from /data/mysql201207
14:41:25 mysqld_safe mysqld from pid file /data/mysql/node4.pid ended
201207 14:41:24 mysqld_safe Starting mysqld daemon with databases from /data/mysql2020-12-07
14:41:25 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated.
Please use --explicit_defaults_for_timestamp server option
(see documentation for more details)./usr/local/mysql/bin/mysqld:
File '/data/mysql/mysql-bin.index' not found (Errcode: 13 - Permission denied)
2020-12-07 14:41:25 4388 [ERROR] Aborting
Two, solution ideas
- When encountering such error messages, we must learn to pay attention to the contents of the error log from time to time. Seeing the key error point Permission denied, it proves that the data directory of the current MySQL database does not have permission.
Three, the solution
[root@zs data]# chown mysql:mysql -R mysql
[root@zs data]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/etc/my.cnf &
[1] 4402
[root@zs data]# 170720 14:45:56 mysqld_safe Logging to '/data/mysql/error.log'.
201207 14:45:56 mysqld_safe Starting mysqld daemon with databases from /data/mysql
Started successfully.
Four, how to avoid such problems
- How to avoid this kind of problem, I personally suggest that when installing MySQL initialization, be sure to add -user=mysql, so that you can avoid permission problems.
./mysql_install_db --basedir=/usr/local/mysql/ --datadir=/data/mysql/ --defaults-file=/etc/my.cnf --user=mysql