CentOS6.5安裝MySQL5.7詳細教程
阿新 • • 發佈:2019-01-05
- 檢測系統是否已安裝 mysql
[[email protected] ~]# yum list installed | grep mysql - 刪除系統已安裝的 mysql 及其依賴
[[email protected] ~]# yum -y remove mysql-libs.i686 - 給CentOS新增rpm源
wget http://repo.mysql.com//mysql-community-release-el6-5.noarch.rpm
4.安裝yum源
[[email protected] ~]# yum install mysql-community-release-el6-5.noarch.rpm
[
[[email protected] ~]# yum repolist all | grep mysql
[[email protected] ~]# yum-config-manager --disable mysql55-community
[[email protected] ~]# yum-config-manager --disable mysql56-community
[[email protected] ~]# yum-config-manager --enable mysql57-community-dmr - 安裝 MySQL 服務端
[[email protected] ~]#yum install mysql-community-server
Dependency Installed:
mysql-community-client.x86_64 0:5.7.22-1.el6
mysql-community-common.x86_64 0:5.7.22-1.el6
mysql-community-libs.x86_64 0:5.7.22-1.el6
Complete!
看到以上結束語句,表示安裝成功
- 啟動 mysql 服務
[[email protected] ~]# service mysqld start
檢視啟動是否成功:
[
mysqld (pid 10698) 正在執行... - 修改 root 初始密碼
我這裡用的是安全模式下進入設定密碼
[[email protected] ~]#service mysqld stop
[[email protected] ~]#mysqld_safe –skip-grant-tables &
重新開一個終端輸入一下命令,然後直接敲enterj鍵:
[[email protected] ~]#mysql -uroot -p
進入之後,敲use mysql,用mysql資料庫;
修改root使用者密碼
mysql> update user set authentication_string=password(123456) where user='root';
注:mysql5.7的密碼欄位是authentication_string,不是password
重新整理許可權並退出
mysql> >flush privileges;
mysql> >quit
重啟mysql,用密碼123456即可登入mysql
[[email protected] ~]# service mysqld restart
[[email protected] ~]# mysql -u root -p
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
出現以上內容,登入成功
- 設定mysql開機啟動
[[email protected] ~]# chkconfig mysqld on
[[email protected] ~]# chkconfig mysqld status