CentOS 7 系統安裝與遠端連線 MySQL 5.7
CentOS 7 版本將MySQL資料庫軟體從預設的程式列表中移除,那麼CentOS 7版本如何安裝MySQL呢,本文將指導大傢俱體的方法。
以滴滴雲DC2雲主機上的操作為例,首先切換賬戶許可權到root許可權,登入CentOS 7 系統的雲主機後輸入:
[dc2-user@didiyun dc2-user]# sudo su
切換成root許可權,然後執行下面的安裝方法:
官網安裝mysql-server方法:
[root@didiyun dc2-user]# yum install -y wget
[root@didiyun dc2-user]# wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
[root@didiyun dc2-user]# rpm -ivh mysql57-community-release-el7-8.noarch.rpm
[root@didiyun dc2-user]# yum install mysql-community-server -y
啟動MySQL
[root@didiyun dc2-user]# systemctl start mysqld
驗證是否啟動
[root@didiyun dc2-user]# systemctl status mysqld
MySQL安裝完成之後,在/var/log/mysqld.log檔案中給root生成了一個預設密碼。透過下面的方式找到root預設密碼,然後登入MySQL進行修改:
[root@didiyun dc2-user]# grep 'temporary password' /var/log/mysqld.log
2018-05-23T09:24:03.800263Z 1 [Note] A temporary password is generated for root@localhost: p?iT>b?iv7st
可以看到初始密碼為 p?iT>b?iv7st,登入資料庫:
[root@didiyun dc2-user]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 2Server version: 5.7.22Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
重新設定root密碼
mysql> set password for 'root'@'localhost'=password('Mypass12@');
為資料庫設定遠端連線
首先在防火牆規則中開啟3306埠
設定MySQL
mysql> grant all privileges on *.* to root@'%'identified by '123456';
如果是非root使用者(mysql的root使用者)遠端登入,則要先建立使用者
mysql>create user 'username'@'%' identified by 'password';
然後再進行連線
[root@didiyun dc2-user]#mysql -h <IP地址> -uusername -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 5.6.39 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
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>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31559758/viewspace-2219922/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- CentOS 7 安裝 MySQL 5.7CentOSMySql
- CentOS 7 - 安裝MySQL 5.7CentOSMySql
- mysql5.7安裝_centos7MySqlCentOS
- CentOS7 安裝mysql5.7CentOSMySql
- Centos7系統如何安裝MySQL5.7資料庫?CentOSMySql資料庫
- CentOS7下MySQL5.7安裝與配置(YUM)CentOSMySql
- CentOS7下yum安裝MySQL 5.7CentOSMySql
- CentOS7 yum安裝MySQL5.7CentOSMySql
- Mysql安裝和遠端登入--Centos7MySqlCentOS
- centos7安裝圖形化介面並使用Windows遠端連線,安裝xrdpCentOSWindows
- CentOS 7一鍵安裝桌面環境命令(可遠端RDP連線)CentOS
- linux安裝mongoDB與遠端連線LinuxMongoDB
- centos7安裝mysql5.7 使用yumCentOSMySql
- CentOS7利用docker安裝MySQL5.7CentOSDockerMySql
- 在centos7上安裝mysql5.7CentOSMySql
- Centos7下安裝配置MySQL5.7CentOSMySql
- CentOs7 中mysql8 設定遠端連線CentOSMySql
- CentOS 7 配置 VNC 遠端桌面連線CentOSVNC
- VMware workstation16 中Centos7下MySQL8.0安裝過程+Navicat遠端連線CentOSMySql
- ubuntu系統安裝mysql並支援遠端連線的詳細過程UbuntuMySql
- Centos7下安裝Sql*Plus並連線遠端Oralce伺服器CentOSSQL伺服器
- CentOS7 64位下MySQL5.7安裝與配置(YUM)CentOSMySql
- centos安裝mysql5.7CentOSMySql
- docker安裝mysql8.0.20並遠端連線DockerMySql
- CentOS7 透過YUM安裝MySQL5.7CentOSMySql
- CentOS安裝noVNC,以Web方式交付VNC遠端連線CentOSVNCWeb
- CentOS 7遠端連線相關問題CentOS
- WindTerm的安裝及遠端連線Linux系統步驟Linux
- Linux 7 安裝Mysql 5.7LinuxMySql
- centOS 7 離線安裝 MySQL 5.6 完美安裝CentOSMySql
- Centos8 stream系統編譯安裝MySQL5.7教程。CentOS編譯MySql
- centos7系統安裝mysql(MariaDB)的教程CentOSMySql
- centos7系統msyqldump 客戶端安裝CentOS客戶端
- 騰訊雲安裝mysql遠端連線不上解決MySql
- 在CentOS7上安裝MySQL5.7-YUM源方式CentOSMySql
- CentOS 7 下使用yum安裝MySQL5.7方法CentOSMySql
- CentOS7.3 安裝 MySQL5.7CentOSMySql
- Centos 7 升級通過 yum 安裝的 MySQL 5.7 到 MySQL 8.0CentOSMySql