初始化失败

来源:2-13 初始化MySQL8.0.15

慕楠枫桥

2021-08-20

[root@tc data]# mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
2021-08-20T03:02:02.237316Z 0 [Warning] [MY-011070] [Server] ‘Disabling symbolic links using --skip-symbolic-links (or equivalent) is the default. Consider not using this option as it’ is deprecated and will be removed in a future release.
2021-08-20T03:02:02.237374Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.15) initializing of server in progress as process 2960
2021-08-20T03:02:02.238115Z 0 [Warning] [MY-013242] [Server] --character-set-server: ‘utf8’ is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please consider using UTF8MB4 in order to be unambiguous.
2021-08-20T03:02:02.239168Z 0 [ERROR] [MY-010124] [Server] Fatal error: Can’t change to run as user ‘mysql’ ; Please check that the user exists!
2021-08-20T03:02:02.239171Z 0 [ERROR] [MY-013236] [Server] Newly created data directory /usr/local/mysql/data/ is unusable. You can safely remove it.
2021-08-20T03:02:02.239212Z 0 [ERROR] [MY-010119] [Server] Aborting
2021-08-20T03:02:02.239312Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.15) MySQL Community Server - GPL.

[root@tc data]# vim etc/my.cnf
[root@tc data]# vim /etc/my.cnf

[mysqld]
datadir=/usr/local/mysql/data
basedir=/usr/local/mysql
socket=/tmp/mysql.sock
character-set-server=utf8
skip-grant-tables
socket=/var/lib/mysql/mysql.sock

Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

Settings user and group are ignored when systemd is used.

If you need to run mysqld under a different user or group,

customize your systemd unit file for mariadb according to the

[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

include all files from the config directory

!includedir /etc/my.cnf.d

老师,这是什么原因了

写回答

1回答

sqlercn

2021-08-20

你的系统中存在mysql这个账号吗?要初始化前要先使用user add mysql 增加mysql 系统账号。
0
0

零基础入门 详解企业主流数据库MySQL8.0

掌握SQL优化与慢查询优化,具备独当一面的能力

1641 学习 · 485 问题

查看课程