[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
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