CentOS7 安裝 mysql

一、下載myslq repo源mysql

wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

二、安裝mysql-community-release-el7-5.noarch.rpm包sql

rpm -ivh mysql-community-release-el7-5.noarch.rpm

三、安裝mysqlide

yum install mysql-server

四、重啓mysql服務rest

systemctl restart  mysqld.service

五、修改mysql的root默認無密碼code

[root@localhost ~]# mysql -uroot
mysql> use mysql

mysql> update user set password=password('admin') where user='root';
mysql>flush privileges;

六、開機啓動server

[root@localhost ~]# systemctl enable mysqld

七、設置遠程訪問mysqlget

mysql>  grant all privileges on *.* to 'root'@'%' identified by 'admin';
mysql> flush privileges;

以上步驟完成後再關閉防火牆it

systemctl start firewalld.service#啓動firewall
systemctl stop firewalld.service#中止firewall
systemctl disable firewalld.service#禁止firewall開機啓動date

相關文章
相關標籤/搜索