Centos7+Mysql80安裝+遠程鏈接開啟
CentOS7安裝mysql80
下載repo源
在xshell運行命令
# wget http://repo.mysql.com/mysql80-community-release-el7.rpm
安裝
# rpm -ivh mysql80-community-release-el7.rpm
MySQL安裝
# yum install mysql
# yum install mysql-server
# yum install mysql-devel
mysql 是 MySQL 客戶端,mysql-server 是數據庫服務器,mysql-devel 則包含了開發用到的庫以及頭文件。
這步可能會花些時間,安裝完成後就會覆蓋掉之前的 mariadb:
過程中遇到的選擇項直接輸入y就行
啟動MySQL服務
啟動 MySQL 服務:
# systemctl start mysqld.service
查看運行狀態
# systemctl status mysqld.service
成功開啟的截圖
查看密碼:
# grep "password" /var/log/mysqld.log
->登錄數據庫
修改密碼
mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY‘new password‘;
開啟遠程登錄數據庫
3306端口
先確保有打開3306端口,可以上阿裏雲添加入站規則,或者直接命令行打開防火墻端口,請自行google。
在user表創建一個新用戶並給予所有權限
mysql> CREATE USER ‘eangaie‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘xxxxxx‘;
mysql>GRANT ALL PRIVILEGES ON *.* TO‘eangaie‘@‘localhost‘;
更新Host
update user set Host =‘%‘ where User =‘eangaie‘;
權限刷新
mysql> flush privileges;
navicat鏈接測試通過
Centos7+Mysql80安裝+遠程鏈接開啟