2016-05-26T09:30:27.839300Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-05-26T09:30:29.769641Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-05-26T09:30:30.051308Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-05-26T09:30:30.145629Z 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: 7cd43705-2324-11e6-9f04-5254001c11ad.
2016-05-26T09:30:30.153626Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-05-26T09:30:30.163438Z 1 [Note] A temporary password is generated for root@localhost: &iiaod5Z/f:H
以上信息可以看到随机密码为 &iiaod5Z/f:H
备份配置文件
cd /etc/
mv my.cnf my.cnf.bak
cp /usr/local/mysql/support-files/my-default.cnf /etc/my.cnf
编辑配置文件
vi my.cnf
chown mysql:mysql -R /data/3306 /usr/local/mysql
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 2345 mysqld on
编辑环境变量
vi /etc/profile
最后一行添加
PATH=$PATH:/usr/local/mysql/bin
重新加载环境变量,启动mysql
source /etc/profile
/etc/init.d/mysqld start
进入Mysql
mysql -u root -p
输入密码: &iiaod5Z/f:H
必须修改密码,否则提示
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
修改密码为root
alter user 'root'@'localhost' identified by 'root';
quit;
再次进入
mysql -u root -proot
执行命令,就可以了
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
+--------------------+
4 rows in set (0.00 sec)