一、 yum安装步骤
1、Centos7.6 默认安装了mariadb数据库,这里把他移除:
rpm -qa | grep mariadb
rpm -e --nodeps mariadb-libs-5.5.64-1.el7.x86_64
2、添加MySQL Yum存储库
wget https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
rpm -Uvh mysql80-community-release-el7-3.noarch.rpm
yum localinstall mysql80-community-release-el7-3.noarch.rpm
3、 问题解决:Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
yum provides ‘*/applydeltarpm‘
yum install deltarpm -y
4、安装数据库
yum install mysql-community-server -y
5、启动测试:
service mysqld start
service mysqld status
二、二进制包安装
1、下载安装文件
mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz
2、解压文件
xz -d mysql-8.0.18-linux-glibc2.12-x86_64.tar.xz
mkdir /usr/local/mysql
tar -xvf mysql-8.0.18-linux-glibc2.12-x86_64.tar -C /usr/local/
3、安装命令
groupadd mysql
useradd -r -g mysql -s /bin/false mysql
cd /usr/local
ln -s /usr/local/mysql-8.0.18-linux-glibc2.12-x86_64 /usr/local/mysql
cd mysql
mkdir data
chown mysql:mysql data
chmod 750 data
./bin/mysqld --initialize --user=mysql
错误处理:./bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory
yum -y install numactl
[[email protected]_0_13_centos mysql]# ./bin/mysqld --initialize --user=mysql
2020-01-08T13:46:42.040071Z 0 [System] [MY-013169] [Server] /usr/local/mysql-8.0.18-linux-glibc2.12-x86_64/bin/mysqld (mysqld 8.0.18) initializing of server in progress as process 19212
2020-01-08T13:46:46.850182Z 5 [Note] [MY-010454] [Server] A temporary password is generated for [email protected]: iB;ojnbO)0dM
./bin/mysql_ssl_rsa_setup
./bin/mysqld_safe --user=mysql &
# Next command is optional
cp support-files/mysql.server /etc/init.d/mysql.server
4、首次登陆后修改密码
mysql -uroot -p
输入第3步记下的密码
ALTER USER "root"@"localhost" IDENTIFIED WITH mysql_native_password BY "password";
FLUSH PRIVILEGES;
修改可以远程登录:
use mysql
select host,user from user;
update user set host=‘%‘ where user=‘root‘;
FLUSH PRIVILEGES;
原文地址:https://www.cnblogs.com/zutanhongke/p/12169128.html