1. 查看是否安装mysql
rpm -q mysql
2. 安装mysql
yum install mysql mysql-server -y
3. 查看mysql 安装信息
rpm -qi mysql
4. 启动mysql服务
service mysqld start
5. 设置mysql 密码
mysqladmin -u root password ‘123456’
6. 连接mysql
mysql -u root -p
chkconfig 查看启动列表
7. 设置开机启动mysql
chkconfig mysqld on 235
8. 开启3306端口并保存
/sbin/iptables -I INPUT -p tcp –dport 3306 -j ACCEPT
/etc/rc.d/init.d/iptables save
9. 修改mysql密码
use mysql;
update user set password=password(‘123456′) where user=’root’;
flush privileges;
10. 设置Mysql远程访问
- 改表法
use mysql;
update user set host = ‘%’ where user = ‘root’;
- 授权法 ‘root’为授权角色,’%’为授权IP,’123456’为授权角色的密码
grant all privileges on *.* to ‘root’@’%’ identified by ‘123456’ with grant option;
flush privileges;
11. 设置编码,编辑/etc/my.cnf
[mysqld]
default-character-set = utf8
character_set_server=utf8
Comments | NOTHING