CentOS7下安装MySQL

栏目: 数据库 · 发布时间: 6年前

内容简介:下载安装软件源:安装成功后重启mysql服务初次安装mysql,root账户没有密码

下载安装软件源:

# 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,root账户没有密码

# mysql -u root

设置密码:

mysql> set password for 'root'@'localhost'=password('password');
Query OK, 0 rows affected (0.00 sec)
 
mysql> exit
Bye

设置允许远程连接

mysql> grant all privileges on *.* to root@'%'identified by 'password';
Query OK, 0 rows affected (0.00 sec)
 
mysql> 

如果允许root账号远程连接要对系统数据库的root账户设置远程访问的密码,与本地的root访问密码并不冲突。

grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option; #123456为你需要设置的密码

参考连接:

https://www.cnblogs.com/chxuyuan/p/7707392.html


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

The Practice of Programming

The Practice of Programming

Brian W. Kernighan、Rob Pike / Addison-Wesley / 1999-2-14 / USD 49.99

With the same insight and authority that made their book The Unix Programming Environment a classic, Brian Kernighan and Rob Pike have written The Practice of Programming to help make individual progr......一起来看看 《The Practice of Programming》 这本书的介绍吧!

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具