美文网首页
MySQL安装与配置

MySQL安装与配置

作者: 阿兹克卡 | 来源:发表于2018-01-03 11:18 被阅读0次

1.下载安装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

2.安装成功后重启服务

# service mysqld restart

3.配置root密码

初次登陆不需要密码

# mysql -u root

为root用户配置密码

mysql> set passwordfor'root'@'localhost'=password('password');

4.MySQL编码配置

mysql配置文件为/etc/my.cnf

最后加上编码配置

[mysql]

default-character-set =utf8

这里的字符编码必须和/usr/share/mysql/charsets/Index.xml中一致。

5.MySQL远程连接

把在所有数据库的所有表的所有权限赋值给位于所有IP地址的root用户。

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

如果是新用户而不是root,则要先新建用户

mysql>create user'username'@'%'identified by'password';

此时就可以进行远程连接了。

相关文章

网友评论

      本文标题:MySQL安装与配置

      本文链接:https://www.haomeiwen.com/subject/dlhhnxtx.html