cenots6.8 安装mysql5.7

wget https://dev.mysql.com/get/mysql57-community-release-el6-9.noarch.rpm
rpm -Uvh mysql57-community-release-el6-9.noarch.rpm 
yum install mysql-community-server
service mysqld start
grep 'temporary password' /var/log/mysqld.log 本次安装的root密码是自动生成的 需要在这个文件查看
[khkt@iZ2zec10406ai3oqpkq01rZ ~]$ grep 'temporary password' /var/log/mysqld.log
2018-04-14T12:33:50.527570Z 1 [Note] A temporary password is generated for root@localhost: n8Yj;#k3hkaa
复制localost 后面的密码
mysql -u root -p 
    修改root密码 可能会出现一个密码不安全不然修改的问题 设置的稍微复杂一点就好,第一个字母大写基本都没有问题
ALTER USER 'root'@'localhost' IDENTIFIED BY 'NewPass!';
开启远程连接
vi /etc/sysconfig/iptables 添加配置开放3306端口
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3306 -j ACCEPT
GRANT ALL PRIVILEGES ON * . * TO ‘root’@’%’ IDENTIFIED BY ‘你的密码’ WITH GRANT OPTION; 
 因为我用的是阿里云的服务器,默认防火墙一般都是关闭的,有一点要注意,阿里云有一个安全组的设置,端口是在那里配置的,要想远程访问,需要将3306端口开放访问权限

设置编码

vi /etc/my.cnf
[mysqld]
character-set-server=utf8 
collation-server=utf8_general_ci 
sql_mode='NO_ENGINE_SUBSTITUTION'
[mysql] default-character-set = utf8 [mysql.server] default-character-set = utf8 [mysqld_safe] default-character-set = utf8 [client] default-character-set = utf8
重启mysql
service mysqld restart




阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页