在此之前先关闭防火墙
shell > wget http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm
shell > yum localinstall -y mysql57-community-release-el7-7.noarch.rpm
shell > yum install -y mysql-community-server
shell > vi /etc/my.cnf
在[mysqld]下添加
skip-grant-tables
skip-networking
shell > systemctl start mysqld.service
shell > mysql -uroot -p
shell > update mysql.user set authentication_string=password("yourpassword") where user="root" and Host="localhost";
shell > flush privileges;
shell > quit;
shell > systemctl restart mysqld;
use mysql;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '你的密码' WITH GRANT OPTION;
注:'%'代表任意地址,也可以指定IP
备注:修改mysql配置文件
vim /etc/my.cnf
[mysqld] 下修改
character-set-server=utf8
collation-server=utf8_general_ci 参数说明:
haracter_set_client:客户端请求数据的字符集。
character_set_connection:从客户端接收到数据,然后传输的字符集。
character_set_database:默认数据库的字符集,无论默认数据库如何改变,都是这个字符集;如果没有默认数据库,使character_set_server指定的字符集,此参数无需设置。
character_set_filesystem:把操作系统上文件名转化成此字符集,即把character_set_client转换character_set_filesystem,默认binary即可。
character_set_results:结果集的字符集。
character_set_server:数据库服务器的默认字符集。
character_set_system:这个值总是utf8,不需要设置,存储系统元数据的字符集。
4.2修改mysql配置文件(设置区分大小写)
lower_case_table_names 参数详解: 0:区分大小写 1:不区分大小写