欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

MySQL 8.0 安装(centos)

程序员文章站 2022-04-09 23:16:39
...

下载 https://dev.mysql.com/downloads/mysql/

MySQL 8.0 安装(centos)

# rpm -qa | grep mariadb 查看是否老版本的安装 如果有进行卸载
# rpm -e mariadb-libs-5.5.56-2.el7.x86_64 --nodeps 卸载
# cd /usr/local/mysql上传刚才的下载文件
# tar -xvf mysql-8.0.17-1.el6.x86_64.rpm-bundle.tar
# rpm -ivh mysql-community-common-8.0.17-1.el6.x86_64.rpm --nodeps --force
# rpm -ivh mysql-community-libs-8.0.17-1.el6.x86_64.rpm --nodeps --force
# rpm -ivh mysql-community-client-8.0.17-1.el6.x86_64.rpm --nodeps --force
# rpm -ivh mysql-community-server-8.0.17-1.el6.x86_64.rpm --nodeps --force
# rpm -qa | grep mysql
# mysqld --initialize;  --初始化操作
# chown mysql:mysql /var/lib/mysql -R;
# systemctl start mysqld.service;  --service mysqld start(centos6)
# systemctl enable mysqld;  --centos6 可以不用执行
# cat /var/log/mysqld.log | grep password 命令查看数据库的密码 F3SvsQrWay:i
# mysql -uroot -p

> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'jorudan0407';
> exit

重新登录
# mysql -uroot -p
    jorudan0407
> create user 'root'@'%' identified with mysql_native_password by 'jorudan0407';
> grant all privileges on *.* to 'root'@'%' with grant option;
> flush privileges;
> ALTER USER 'root'@'localhost' IDENTIFIED BY 'jorudan0407' PASSWORD EXPIRE NEVER;
> flush privileges;
> exit

端口开放

# /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
# /etc/init.d/iptables save
# service iptables restart
# netstat -ntlp

service mysqld start

出现的一些问题:

  1. bin/mysqld: error while loading shared libraries: libnuma.so.1:
    yum -y install numactl 即可

  2. /lib64/libc.so.6: version `GLIBC_2.14’ not found

# wget http://ftp.gnu.org/gnu/glibc/glibc-2.15.tar.gz  
# wget http://ftp.gnu.org/gnu/glibc/glibc-ports-2.15.tar.gz  
# tar -xvf  glibc-2.15.tar.gz  
# tar -xvf  glibc-ports-2.15.tar.gz  
# mv glibc-ports-2.15 glibc-2.15/ports  
# mkdir glibc-build-2.15   
# cd glibc-build-2.15
# ../glibc-2.15/configure  --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin  
    make  
    make install
  1. version `GLIBCXX_3.4.15’ not found
# find / -name libstdc++.so.6
/usr/lib64/libstdc++.so.6
# cd /usr/lib64/
  将文件放到改目录下libstdc++.so.6.0.18
# chmod 755 libstdc++.so.6.0.18
# mv libstdc++.so.6 libstdc++.so.6-old
# ln -sf libstdc++.so.6.0.18 libstdc++.so.6
# strings /usr/lib64/libstdc++.so.6 | grep GLIBC