./bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql57/ --datadir=/mysqldata
./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
./bin/mysqld --initialize --datadir=/mysqldata
dadlI
首次安装
[root@localhost mysql57]# ./bin/mysqld --initialize --datadir=/mysqldata
2019-03-26T02:35:50.743709Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-03-26T02:35:50.743828Z 0 [ERROR] Can't find error-message file '/usr/local/mysql/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
2019-03-26T02:35:50.744762Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.
2019-03-26T02:35:50.744784Z 0 [ERROR] Aborting
再次初始化 ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
[root@localhost mysql]# ./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/
2019-03-26T02:39:41.951440Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2019-03-26T02:39:42.333828Z 0 [Warning] InnoDB: New log files created, LSN=45790
2019-03-26T02:39:42.408721Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2019-03-26T02:39:42.470209Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 68ccea0c-4f70-11e9-b878-0cc47a90c0aa.
2019-03-26T02:39:42.472276Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2019-03-26T02:39:42.473157Z 1 [Note] A temporary password is generated for root@localhost: ca4DZJRog!SK
配置文件
cp -a ./support-files/my-default.cnf /etc/my.cnf
新下的软件包不存在 my-default.cnf 这个文件
启动报错:
[root@localhost mysql]# service mysqld start
Starting MySQL.2019-03-26T02:45:10.453082Z mysqld_safe Directory '/var/lib/mysql' for UNIX socket file don't exists.
The server quit without updating PID file (/usr/local/mysql[FAILED]calhost.localdomain.pid).
修改mysql.cnf中的socket文件: socket = /tmp/mysql.sock
进去需要先修改密码
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
修改密码; set password = password('ca4DZJRog#SK')
flush privileges