安装Mysql的命令:
wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm
yum install mysql-community-server
安装完之后重启一下mysql服务:
service mysqld restart
会输出:Redirecting to /bin/systemctl restart mysqld.service
连接Mysql:
mysql
此时直接连接mysql即可,msyql默认密码为空,需要自己设置密码
设置Mysql密码:
set password for 'root'@'localhost' = password('xxx');
远程连接Mysql:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'root' WITH GRANT OPTION;
flush privileges;