目录
一:从mysql官网下载安装包
二:安装
一:查看linux中自带的数据库并卸载
二:解压上传的mysql压缩包
三: 安装mysql
1 依次安装
2 初始化
3 设置权限
4 启动 数据库
5 获取初始化密码
6 登录并更改密码
7 安装完成退出
一: 设置远程连接
二:解决mysql8密码加密乱码问题
四:Xshell连接异常问题
MySQL :: Download MySQL Community Server (Archived Versions)
下载完成可以通过Xshell 传到linux服务器中
rpm -qa|grep mariadb
rpm -e --nodeps mariadb-libs
tar -xvf mysql-8.0.28-1.el7.x86_64.rpm-bundle.tar
rpm -ivh mysql-community-common-8.0.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.0.28-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.28-1.el7.x86_64.rpm
mysqld --initialize --console
chown -R mysql:mysql /var/lib/mysql/
systemctl start mysqld
cat /var/log/mysqld.log|grep localhost
我的密码为: =h7DDp7yY?6t
mysql -uroot -p=h7DDp7yY?6t
alter user 'root'@'localhost' identified by 'root';
exit
mysql -uroot -proot
注意:若临时密码中有特殊字符则不能正常进入mysql 需要换成
mysql -uroot -p
=h7DDp7yY?6t
quit
连接服务器: mysql -u root -proot
进入mysql数据库:use mysql;
修改user表中的Host:update user set Host='%' where User='root';
最后刷新一下:flush privileges;
mysql -u root -proot
use mysql;
update user set Host='%' where User='root';
flush privileges;
mysql -uroot -proot
use mysql;
ALTER USER 'root'@'%' IDENTIFIED BY 'root' PASSWORD EXPIRE NEVER;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root';
FLUSH PRIVILEGES;
在 /etc/ssh/sshd_config 中添加
KexAlgorithms [email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group14-sha
然后重新加载
systemctl restart sshd