卸载默认数据
CentOS7默认安装mariadb数据库: yum remove mariadb-libs.x86_64
下载Mysql源,并安装
wget https://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm #安装rpm包 yum localinstall mysql57-community-release-el7-8.noarch.rpm
安装MySQL
yum install mysql-community-server
解决依赖
安装numactl [root@VM_0_6_centos tmp]# yum install numactl Loaded plugins: fastestmirror, langpacks Repository epel is listed more than once in the configuration Loading mirror speeds from cached hostfile Resolving Dependencies --> Running transaction check ---> Package numactl.x86_64 0:2.0.12-3.el7_7.1 will be installed --> Processing Dependency: libnuma.so.1(libnuma_1.4)(64bit) for package: numactl-2.0.12-3.el7_7.1.x86_64 --> Processing Dependency: libnuma.so.1(libnuma_1.3)(64bit) for package: numactl-2.0.12-3.el7_7.1.x86_64 --> Processing Dependency: libnuma.so.1(libnuma_1.2)(64bit) for package: numactl-2.0.12-3.el7_7.1.x86_64 --> Processing Dependency: libnuma.so.1(libnuma_1.1)(64bit) for package: numactl-2.0.12-3.el7_7.1.x86_64 ……
启动数据库
service mysqld start/restart
查看数据库密码,并修改
cat /var/log/mysqld.log|grep 'password' mysql -uroot -p
重置密码
#注意:如果只想设置简单密码需要修改两个全局参数: mysql> set global validate_password_policy=0; mysql> set global validate_password_length=1; #修改 mysql> SET PASSWORD = PASSWORD('123456');
设置root远程登录,关闭防火墙
update mysql.`user` set Host = '%' where User = 'root' and Host = 'localhost'; flush privileges; 或者重启服务 sudo service mysqld restart /*关闭防火墙*/ sudo service firewalld stop