Linux Cent7 已安装MySQL5.7.X,再安装MYSQL8.4.2
一、 下载安装
检查Linux系统的glibc版本rpm -qa | grep glibc
结果:glibc-common-2.17-260.el7_6.6.x86_64
glibc-2.17-260.el7_6.6.x86_64
glibc-headers-2.17-260.el7_6.6.x86_64
glibc-devel-2.17-260.el7_6.6.x86_64
访问MySQL官网,下载对应版本数据库 上传服务器并解压 解压xz文件成tarxz -d mysql-8.4.2-linux-glibc2.17-x86_64.tar.xz
解压tar文件,然后重命名成“mysql-8.4.2 ”tar -xvf mysql-8.4.2-linux-glibc2.17-x86_64.tar -C ./
二、数据库服务部署
赋予权限chown -R mysql.mysql ./mysql-8.4.2
创建配置文件vim ./mysql-8.4.2/my.cnf
“my.cnf”配置内容:[client]
port=3307mysqlx_port=33070
socket=/tmp/mysql84.sock
mysqlx_socket=/tmp/mysqlx84.sock[mysqld]
# skip-grant-tables
# mysql安装目录
basedir=/usr/local/mysql-8.4.2
# mysql数据库目录
datadir=/usr/local/mysql-8.4.2/data
port=3307
innodb_file_per_table=1
character-set-server=utf8
mysqlx_port=33070
socket = /tmp/mysql84.sock
mysqlx_socket=/tmp/mysqlx80.sock[mysqld_safe]
# 错误日志
log-error=/usr/local/mysql-8.4.2/data/error.log
# pid文件
pid-file=/usr/local/mysql-8.4.2/data/mysqld.pid
tmpdir=/tmp/mysql84
赋予配置文件权限chmod 755 ./mysql-8.4.2/my.cnf
修改服务器文件vim ./mysql-8.4.2/support-files/mysql.server
“mysql.server”修改内容:basedir=/usr/local/mysql-8.4.2
datadir=/usr/local/mysql-8.4.2/datalockdir='/var/lock/subsys'
lock_file_path="$lockdir/mysql84" mysqld_pid_file_path=/usr/local/mysql-8.4.2/data/mysqld.pidconf=/usr/local/mysql-8.4.2/my.cnf
复制注册连接服务文件cp -i ./mysql-8.4.2/support-files/mysql.server /etc/init.d/mysql84
初始化数据库./mysql-8.4.2/bin/mysqld --defaults-file= /usr/local/mysql-8.4.2/my.cnf --user= mysql --initialize
初始化成功,查看输出日志,找到初始密码2024-10-04T12:06:18.478525Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: XH>)njhBE5VC
三、数据库账号配置
启动数据库/usr/local/mysql-8.4.2/bin/mysqld_safe --defaults-file= /usr/local/mysql-8.4.2/my.cnf
登录数据库./mysql-8.4.2/bin/mysql --socket= /tmp/mysql84.sock -u root -p
修改初始密码ALTER USER 'root' @'localhost' IDENTIFIED BY '123456' ;
FLUSH PRIVILEGES;
运行远程登录use mysql;
update user set user.Host = '%' where user.User= 'root' ;
flush privileges;
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/diannao/55667.shtml
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!