系统具体配置,版本信息:
代码语言:txt复制centos7.9 安装 mysql-8.0.29
查询linux系统版本信息
代码语言:txt复制uname -a
代码语言:txt复制查询具体glibc 版本信息:
ldd --version
下载地址:
代码语言:txt复制版本要根据自己的系统选择(也就是上一步得到的信息)
https://mirrors.huaweicloud.com/mysql/Downloads/
下载地址:
https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-8.0/mysql-8.0.29-1.el7.x86_64.rpm-bundle.tar
执行,下载,上传,解压
代码语言:txt复制 tar -xvf MySQL-8.0/mysql-8.0.29-1.el7.x86_64.rpm-bundle.tar
解压后的文件:
mysql-8.0.29-1.el7.x86_64.rpm-bundle.tar
mysql-community-client-8.0.29-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.29-1.el7.x86_64.rpm
mysql-community-common-8.0.29-1.el7.x86_64.rpm
mysql-community-debuginfo-8.0.29-1.el7.x86_64.rpm
mysql-community-devel-8.0.29-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.29-1.el7.x86_64.rpm
mysql-community-icu-data-files-8.0.29-1.el7.x86_64.rpm
mysql-community-libs-8.0.29-1.el7.x86_64.rpm
mysql-community-libs-compat-8.0.29-1.el7.x86_64.rpm
mysql-community-server-8.0.29-1.el7.x86_64.rpm
mysql-community-server-debug-8.0.29-1.el7.x86_64.rpm
mysql-community-test-8.0.29-1.el7.x86_64.rpm
------------------安装-----------------------:
1: 检测是否已经安装 :
rpm -qa|grep mysql 全卸载了
rpm -e 包名
find / -name 'mysql'
找到的 :目录:全部用 rm -rf 文件夹 删除掉
rm -rf /etc/my.cnf
2-----安装(rpm -ivh )
需要安装 :
安装顺序不能错
mysql-community-common-8.0.29-1.el7.x86_64.rpm
mysql-community-icu-data-files-8.0.29-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.29-1.el7.x86_64.rpm
mysql-community-libs-8.0.29-1.el7.x86_64.rpm
mysql-community-client-8.0.29-1.el7.x86_64.rpm
mysql-community-libs-compat-8.0.29-1.el7.x86_64.rpm
mysql-community-server-8.0.29-1.el7.x86_64.rpm
安装完成后:
代码语言:txt复制授权
chown -R mysql:mysql /var/lib/mysql/
编辑:vim /etc/my.cnf 处理一些表名大小写的问题,以及默认编码和排序问题
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
lower_case_table_names=1
初始化
代码语言:txt复制mysqld --initialize-insecure --basedir=/usr/local/mysql
之后就可以启动了
代码语言:txt复制systemctl start mysqld.service
如果有异常,就去看看日志报什么错误,看着改改就行
看下启动状态:
systemctl status mysqld.service
如有权限不够,就重新授权一下,chmod -R 777 /var/lib/mysql/
日志默认位置:
tail -f /var/log/mysqld.log