安装
CentOS 7的yum源中貌似没有正常安装mysql时的mysql-sever文件,需要去官网上下载
# 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 -uroot
mysql> set password for ‘root’@‘localhost’ = password('mypasswd');
mysql> exit
5.7 没有 password这个字段了
ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';
搞定!
查找安装位置
:#whereis mysql
给予远程连接权限
腾讯云主机 平台设置安全组:
测试情况关闭防火墙
1、直接关闭防火墙
systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
GRANT ALL PRIVILEGES ON . TO ‘root’@’%’ IDENTIFIED BY ‘密码’ WITH GRANT OPTION;
设置编码
查看:
mysql查看数据库编码,mysql编码
打开数据库运行:show variables like ‘char%’;
http://www.cnblogs.com/woshimrf/p/5880055.html