CentOS7.2安装MySQL

来源:互联网 发布:iphone库存查询软件 编辑:程序博客网 时间:2024/06/05 11:21

快速下载安装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

设置密码

# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('123456') where USER='root' and host='root' or host='localhost';mysql> FLUSH PRIVILEGES;
# quit

启动mysql

# service mysql start
# mysql -uroot -p123456

MySql5.6操作时报错:You must SET PASSWORD before executing this statement解决

mysql> SET PASSWORD = PASSWORD('123456');

设置远程连接

mysql> grant all on *.* to root@'%' identified by '123456'; 

开启端口
首先在阿里云安全组添加 3306端口
在开启防火墙端口

# firewall-cmd --permanent --zone=public --add-port=3306/tcp# firewall-cmd --reload
原创粉丝点击