赞
踩
mysql-5.7.29
centos7.6 1810
软件位置:
链接:https://pan.baidu.com/s/1Q0y9RW4dFgEnmK5Vc3SKUg?pwd=q2sj
提取码:q2sj
2024.4.6-实战:通用二进制格式安装 MySQL(mysql-5.7.29)-2024.4.6(测试成功)
https://downloads.mysql.com/archives/get/p/23/file/mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz
yum -y install libaio numactl-libs
useradd -r -s /bin/false mysql
tar xf mysql-5.7.29-linux-glibc2.12-x86_64.tar.gz -C /usr/local
cd /usr/local/
ln -s mysql-5.7.29-linux-glibc2.12-x86_64/ mysql
chown -R root.root /usr/local/mysql/
echo 'PATH=/usr/local/mysql/bin:$PATH' > /etc/profile.d/mysql.sh
. /etc/profile.d/mysql.sh
cp /etc/my.cnf{,.bak}
vim /etc/my.cnf
[mysqld]
datadir=/data/mysql
skip_name_resolve=1
socket=/data/mysql/mysql.sock
log-error=/data/mysql/mysql.log
pid-file=/data/mysql/mysql.pid
[client]
socket=/data/mysql/mysql.sock
mkdir -p /data/mysql
chown mysql:mysql /data/mysql
mysqld --initialize --user=mysql --datadir=/data/mysql
...省略...
2019-07-04T13:03:54.258140Z 1 [Note] A temporary password is generated for
root@localhost: LufavlMka6,! #注意生成root的初始密码
grep password /data/mysql/mysql.log
2019-12-26T13:31:30.458826Z 1 [Note] A temporary password is generated for
root@localhost: LufavlMka6,!
awk '/temporary password/{print $NF}' /data/mysql/mysql.log
LufavlMka6,!
⚠️ 注意:
我这里实际测试时需要手动创建
/data/mysql
目录的,但老师当时测试时不需要直接创建的。
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
service mysqld start
mysqladmin -uroot -p'LufavlMka6,!' password magedu
另外,自己这里测试时是需要到mysql里去修改密码的,使用mysqladmin是无法正常修改密码的;
自己这里测试时报错了:
[root@vm-template ~]#awk '/temporary password/{print $NF}' /data/mysql/mysql.log
?Ny,T;oKg5t>
[root@vm-template ~]#
mysqladmin -uroot -p'?Ny,T;oKg5t>' password magedu
[root@vm-template ~]#mysqladmin -uroot -p'?Ny,T;oKg5t>' password magedu
mysqladmin: [Warning] Using a password on the command line interface can be insecure.
mysqladmin: connect to server at 'localhost' failed
error: 'Your password has expired. To log in you must change it using a client that supports expired passwords.'
[root@vm-template ~]#
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。