安装mysql

卸载mysql

[bigdata@node101 ~]$ sudo rpm -qa | grep mariadb | xargs sudo rpm -e --nodeps

上传安装包到/opt/software目录并解压

[bigdata@node101 software]$ tar -xf mysql-5.7.28-1.el7.x86_64.rpm-bundle.tar -C  mysql_lib/ 

到mysql_lib目录下顺序安装

[bigdata@node101 mysql_lib]$ sudo rpm -ivh  mysql-community-common-5.7.28-1.el7.x86_64.rpm                   
[bigdata@node101 mysql_lib]$ sudo rpm -ivh  mysql-community-libs-5.7.28-1.el7.x86_64.rpm                        
[bigdata@node101 mysql_lib]$ sudo rpm -ivh  mysql-community-libs-compat-5.7.28-1.el7.x86_64.rpm                
[bigdata@node101 mysql_lib]$ sudo rpm -ivh  mysql-community-client-5.7.28-1.el7.x86_64.rpm                      
[bigdata@node101 mysql_lib]$ sudo rpm -ivh  mysql-community-server-5.7.28-1.el7.x86_64.rpm  

重启mysql

[bigdata@node101 ~]$ sudo systemctl restart mysqld

查看mysql状态

[bigdata@node101 ~]$ systemctl status mysqld

查看root密码

[bigdata@node101 ~]$ sudo cat /var/log/mysqld.log | grep password

重置密码

[bigdata@node101 ~]$ mysql -uroot -p'lzOkJwdks5+!' 

mysql> set global validate_password_policy=0; 
mysql> set global validate_password_length=6 ; 
mysql> set password=password("123456"); 
mysql> use mysql 

设置远程登录

mysql> update user set host="%" where user="root";  
mysql> flush privileges; 

修改字符集编码

[bigdata@node101 ~]$ sudo vim /etc/my.cnf 
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8

重启mysql

[bigdata@node101 ~]$ sudo systemctl restart mysqld

设置开机启动

[bigdata@node101 ~]$ sudo vim /etc/rc.d/rc.local 

service mysqld start

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部