1 yum -y install mysql-server

2 加入开机启动
chkconfig --add mysqld
chkconfig mysqld on
3 service mysqld start


第一次登陆不需要密码 enter
设置密码 Y

移除其他用户Y

禁止远程用户登录 N 设置错了

移除测试数据库随意

欢迎使用

4 修改任何机器都可以登录
(1)进入MySQL
[root@hadoop01 mysql-libs]# mysql -uroot -p000000
(2)显示数据库
mysql>show databases;
(3)使用MySQL数据库
mysql>use mysql;
(4)展示MySQL数据库中的所有表
mysql>show tables;
(5)展示user表的结构
mysql>desc user;
(6)查询user表
mysql>select User, Host, Password from user;
(7)修改user表,把Host表内容修改为%
mysql>update user set host='%' where host='localhost';
(8)删除root用户的其他host
mysql>
delete from user where Host='hadoop102';
delete from user where Host='127.0.0.1';
delete from user where Host='::1';
(9)刷新
mysql>flush privileges;
(10)退出
mysql>quit;
上传jdbc驱动
mkdir -p /usr/share/java/
/usr/share/java/
ln -s mysql-connector-java-5.1.37.jar mysql-connector-java.jar
[图片上传失败...(image-dc7cb-1563295508834)]
网友评论