Mysql启动错误:Please read "Security" section of the manual to find out how to run mysqld as root!

错误

2019-01-10T15:03:17.368118Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2019-01-10T15:03:17.368146Z 0 [ERROR] Aborting

解决方案

加入启动参数--user=[username]
配置my.cnf,加入user=mysql意思是使用用户名mysql运行mysqld服务器

[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
#default-character-set = utf8
#character-set-server = utf8
port=3406
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0

log-error=/var/log/sunpy.err
pid-file=/var/run/mysqld/mysqld.pid
user=mysql

启动mysqld服务器带--user=mysql参数

mysqld --user=mysql --explicit_defaults_for_timestamp

查看下:

service mysqld status

[root@izuf6ea4rfo45y44oj74jhz ~]# service mysqld status
MySQL running (24617)                                      [  OK  ]

也可以通过启动日志去查看:tail -f /var/log/sunpy.err


像我启动的时候还报了,sunpy.err文件没有权限,打不开等。

chmod 777 /var/log/sunpy.err

你可能感兴趣的:(Mysql启动错误:Please read "Security" section of the manual to find out how to run mysqld as root!)