云服务器上安装MySQL5.6
使用root账户,通过Xshell5远程登录阿里云服务器。
下载rpm包,并安装,执行命令:
| 1 | rpm -Uvh http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm | 
执行命令,查看当前可用的mysql安装资源。
| 1 | yum repolist enabled | grep "mysql.*-community.*" | 
执行命令:
| 1 | yum -y install mysql-community-server | 
设置开机启动Mysql
| 1 | systemctl enable mysqld | 
执行命令
| 1 | systemctl list-unit-files | grep mysqld | 
如果显示以下内容说明已经完成自动启动安装。
| 1 | mysqld.service enabled | 
执行命令,启动mysql服务
| 1 | systemctl start mysqld | 
查看mysql服务是否已启动
| 1 | ps -ef|grep mysql查看mysql | 
执行命令,进行Mysql配置,比如,设置root用户密码
| 1 | mysql_secure_installation | 
| 1 | Remove anonymous users? [Y/n] y [删除匿名用户] | 
登陆MySql,输入用户名和密码
| 1 | mysql -uroot -p | 
修改当前用户密码
| 1 | update user set password=password("你的新密码") where user="root"; | 
开启远程登录,授权root远程登录
| 1 | GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION; | 
刷新权限,命令立即执行生效
| 1 | flush privileges; | 
修改字符集
| 1 | [client] | 
常用命令
| 1 | //通过yum安装Mysql,会自动处理Mysql与其他组件的依赖关系 | 
 
        