虚拟机下安装MYSQL
第一步
yum install mysql mysql-server
下载mysql的包,该操作可以在opt目录下操作。
第二步关闭防火墙
#chkconfig --levels 235 mysqld on
#chkconfig iptables on chkconfig iptables off
永久关闭或开启防火墙 关机重启后不收改变
#service iptables start 本次开启
# service iptables stop 关闭防火墙
第三步使MySQL初始化(启动mysqld)
service mysqld start /etc/init.d/mysqld start
两条命令都可以生效
(2)初始化的同时注意更改MySQL的密码
设置 root 的密码为 admin
mysql_secure_installation
输入老密码,确认密码
第四步
重启mysql
service mysqld restart
第五步
登录数据库
语法:mysql -u root -p密码
第六步给mysql设置网络
语法:grant all privileges on . to ‘root’@’%%’ identified by ‘123456’ with grant option;
这里我的密码是123456 参考者,根据自己的账号跟密码进行调整即可。