19 / 09 / 18

MySQL 安装配置

系统

CentOS7.x

安装

yum install mysql

yum install mysql-devel

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 -u root
set password for 'root'@'localhost' =password('8sIjjbzAxWSsC65A');

修改配置文件

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

加上编码配置

default-character-set =utf8

远程连接

mysql> grant all privileges on *.* to server@'%'identified by '8sIjjbzAxWSsC65A';

创建新用户

mysql>create user 'server'@'%' identified by '8sIjjbzAxWSsC65A';