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;
大功告成?。。?/p>
一些坑??!
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).
太多沒用的日志就不貼出來了。
如果問題歡迎指正。