配置文件在 /etc/my.cnf
日志 /var/log/mysqld.log
报错:
在执行 systemctl start mysqld 时
Job for mysqld.service failed because the control process exited with error code. See "systemctland "journalctl -xe" for details.
解决:
把my.cnf里的datadir目录清空
//可能遗留冲突吧
my.cnf如下:
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
日志分割上是报错的,下是成功的(初始密码)如下:
mysqld: Table 'mysql.plugin' doesn't exist
2020-03-30T01:46:05.790862Z 0 [ERROR] [MY-010735] [Server] Could not open the mysql.plugin table. Please perform the MySQL upgrade procedure.
2020-03-30T01:46:05.862425Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-03-30T01:46:05.953447Z 0 [Warning] [MY-010015] [Repl] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2020-03-30T01:46:05.960271Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-03-30T01:46:05.966924Z 0 [Warning] [MY-010441] [Server] Failed to open optimizer cost constant tables
2020-03-30T01:46:05.967339Z 0 [ERROR] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-001146 - Table 'mysql.component' doesn't exist
2020-03-30T01:46:05.967525Z 0 [Warning] [MY-013129] [Server] A message intended for a client cannot be sent there as no client-session is attached. Therefore, we're sending the information to the error-log instead: MY-003543 - The mysql.component table is missing or has an incorrect definition.
2020-03-30T01:46:05.968385Z 0 [ERROR] [MY-010326] [Server] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2020-03-30T01:46:05.968637Z 0 [ERROR] [MY-010952] [Server] The privilege system failed to initialize correctly. For complete instructions on how to upgrade MySQL to a new version please see the 'Upgrading MySQL' section from the MySQL manual.
2020-03-30T01:46:05.969016Z 0 [ERROR] [MY-010119] [Server] Aborting
2020-03-30T01:46:07.281309Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.19) MySQL Community Server - GPL.
---------------------------------------------------------------------------------------------------- 密码在下第二行
2020-03-30T01:55:15.932199Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.19) initializing of server in progress as process 4142
2020-03-30T01:55:20.967699Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: iHU)9EPSmrRP
2020-03-30T01:55:24.734817Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.19) starting as process 4213
2020-03-30T01:55:25.994464Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2020-03-30T01:55:26.074069Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.19' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server - GPL.
2020-03-30T01:55:26.219911Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060
**************setup finished*****************________________Nice
安装成功之后 修改密码
mysql -u root -p
password: log里有
alter user user() identified by '!zZ6' //mysql8 密码规则字母、数字、符号都要有
window 迁移
window端
Navicat 右键数据库转储sql文件
linux
mysql -u root -p
create database XXX
use XXX
source /转储sql文件
show tables