為了賬號安全,請及時綁定郵箱和手機立即綁定

centos7安裝mysql5.6并開啟遠程訪問

2017.03.25 23:14 6060瀏覽
首先安裝mysql5.6的rpm

rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

5.7的源:http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm

安裝mysql

yum install mysql-community-server

運行mysqld

systemctl start mysqld

查看mysqld的運行狀態和一些初始化的提示

systemctl status mysqld
圖片描述

可以看到設置默認密碼的幾種方式

/usr/bin/mysqladmin -u root password 'new-password'

開機啟動mysqld

systemctl enable mysqld

授權遠程訪問

mysql> use mysql;

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

Database changed

mysql> grant all privileges on . to root@'%' identified by "password";

Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

打開3306端口的訪問

firewall-cmd --add-port=3306/tcp --permanent

firewall-cmd --reload

點擊查看更多內容
5人點贊

若覺得本文不錯,就分享一下吧!

評論

相關文章推薦

正在加載中
意見反饋 幫助中心 APP下載
官方微信

舉報

0/150
提交
取消
lpl竞猜