CentOS 安装 MySql

2017-01-11  本文已影响0人  那个初衷

1.检测系统是否自带mysql

# yum list installed | grep mysql

2.删除系统自带的mysql及其依赖命令

# yum -y remove mysql-libs.x86_64

3.给CentOS添加rpm源,并且选择较新的源命令

# wget dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

# yum localinstall mysql57-community-release-el7-9.noarch.rpm

# yum repolist all | grep mysql

# yum repolist enabled | grep mysql

4.安装mysql 服务器命令

# yum install mysql-community-server

5.启动mysql命令

# service mysqld start

6.MySQL 安全设置

mysql_secure_installation;

大功告成!!!




一些坑!!

1.问题描述:数据库安装好后,使用相关命令均出现错误

命令描述:

# mysql -u root -p

# mysql

报错

[ERROR 1045(28000) : Access denied for user 'root@localhost' (using password: no )]

解决:

# mysql -u root -p

Enter password:

默认密码来自于/ver/log/mysqld.log(加粗行包含密码):

2017-01-11T06:04:01.466743Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2017-01-11T06:04:03.722253Z 0 [Warning] InnoDB: New log files created, LSN=45790

2017-01-11T06:04:04.037518Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2017-01-11T06:04:04.114085Z 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: c13049ca-d7c3-11e6-ad8e-00163e3016f9.

2017-01-11T06:04:04.118412Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2017-01-11T06:04:04.119185Z 1 [Note] A temporary password is generated for root@localhost: vFY&6mBo.gk#

2017-01-11T06:04:09.377724Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

太多没用的日志就不贴出来了。

如果问题欢迎指正。


上一篇 下一篇

猜你喜欢

热点阅读