安装mysql
[root@SPARK02 upload]#yum list 'mysql-*'
[root@SPARK02 upload]#yum -y install mysql-server.x86_64
[root@SPARK02 upload]#service mysqld start #启动Mysql
[root@SPARK02 upload]#mysql #测试
mysql>/q #退出
[root@SPARK02 upload]#chkconfig mysqld on #设置Mysql开机启动
#开启3306端口并保存
[root@SPARK02 upload]#/sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
[root@SPARK02 upload]#/etc/rc.d/init.d/iptables save
#数据库安装OK,默认无密码
[root@SPARK02 upload]#mysql
#查看数据库系统用户
mysql>select user,host,password from mysql.user;
mysql>set password for root@localhost=password('spark');#设置root用户密码
mysql>delete from mysql.user where user='' and host='hostname';#删除其他用户
mysql>flush privileges;
*********************************************************************************