全网小程序源码分享

cnetos7.0 安装mysql

CentOS 7的yum源中貌似没有正常安装mysql时的mysql-sever文件,需要去官网上下载

1
2
3
[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服务

1
[root@localhost ~]# /bin/systemctl restart mysqld.service

初次安装mysql是root账户是没有密码的成功安装之后重启mysql服务,

这里我顺带把远程root用户也设定了,

设置密码的方法

1
2
3
4
5
6
[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

posted @   沃弗码客  阅读(552)  评论(0编辑  收藏  举报
努力加载评论中...
全网小程序源码分享
点击右上角即可分享
微信分享提示