cnetos7.0 安装mysql
CentOS 7的yum源中貌似没有正常安装mysql时的mysql-sever文件,需要去官网上下载
[root@localhost ~]# wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql-connectors-community-el7/mysql-community-release-el7-5.noarch.rpm [root@localhost ~]# rpm -ivh mysql-community-release-el7-5.noarch.rpm [root@localhost ~]# yum install mysql-community-server
成功安装之后重启mysql服务
[root@localhost ~]# /bin/systemctl restart mysqld.service
初次安装mysql是root账户是没有密码的成功安装之后重启mysql服务,
这里我顺带把远程root用户也设定了,
设置密码的方法
[root@localhost ~]# mysql -uroot mysql> use mysql; mysql> UPDATE user SET Password = PASSWORD('newpassword') WHERE user = 'root' and host='localhost'; //设置本地root用户密码 mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'newpassword' WITH GRANT OPTION; //创建远程root用户并设置密码 mysql> flush privileges; mysql> exit;
ok,搞定!
PS:阿里云ECS Linux 系统授权 MySQL 外网访问地址https://help.aliyun.com/knowledge_detail/41093.html