! ! ! 跟着文档走安装不上我去吃shi
环境前准备:
● 操作系统:Centos7 X86架构
● Mysql安装版本:8.0.33
● 连接工具:Xshell/Xftp
进入官网下载对应的版本
https://dev.mysql.com/downloads/mysql/
直接复制此链接即可
查看操作系统是ARM还是X86,下载对应架构。
[root@k8s-master02 log]# uname -m
x86_64
查看本地有没有安装mariadb ,有的话删除
[root@localhost ~]# rpm -qa |grep mariadb
[root@localhost ~]# rpm -e --nodeps 软件名
查看本地有没有安装Mysql
[root@localhost ~]# rpm -qa |grep mysql
[root@localhost ~]# rpm -e --nodeps 软件名
查找本地有没有Mysql文件
[root@localhost ~]# find / -name mysql
[root@localhost ~]# whereis mysql
[root@localhost ~]# rm -rf #删除
确保环境准备无误
[root@localhost ~]# rpm -qa |grep mariadb
[root@localhost ~]# find / -name mysql[root@localhost ~]# rpm -qa |grep mysql
环境准备没问题开始上传Mysql安装包安装(rz/xftp)
[root@localhost ~]# ls
mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar
创建一个mysql目录存放解压出来的安装包
[root@localhost ~]# mkdir mysql
[root@localhost ~]# tar -xf mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar -C mysql
[root@localhost ~]# cd mysql
[root@localhost mysql]# ls
mysql-community-client-8.0.33-1.el7.x86_64.rpm
mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm
mysql-community-common-8.0.33-1.el7.x86_64.rpm
mysql-community-debuginfo-8.0.33-1.el7.x86_64.rpm
mysql-community-devel-8.0.33-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.33-1.el7.x86_64.rpm
mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm
mysql-community-libs-8.0.33-1.el7.x86_64.rpm
mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm
mysql-community-server-8.0.33-1.el7.x86_64.rpm
mysql-community-server-debug-8.0.33-1.el7.x86_64.rpm
mysql-community-test-8.0.33-1.el7.x86_64.rpm
开始安装依赖按照顺序安装否则报错
rpm -ivh mysql-community-common-8.0.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-embedded-compat-8.0.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-8.0.33-1.el7.x86_64.rpm
yum install openssl-develrpm -ivh mysql-community-devel-8.0.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.33-1.el7.x86_64.rpm
yum -y install mysql-community*
rpm -ivh mysql-community-server-8.0.33-1.el7.x86_64.rpm
rpm -ivh mysql-community-test-8.0.33-1.el7.x86_64.rpm
开始进行下一步
mysqld --initialize --console #初始化数据库
chown -R mysql:mysql /var/lib/mysql/ #给mysql目录属主属组改成mysql
systemctl start mysqld #启动mysql
systemctl status mysqld #查看mysql状态(active running)cat /var/log/mysqld.log |grep password #查看mysql密码
输入mysql密码
[root@localhost ~]# mysql -u root -p
Enter password:
进入数据库以后要修改密码
mysql> alter user 'root'@'localhost' identified with mysql_native_password by '123123';
Query OK, 0 rows affected (0.00 sec)
至此安装完成
设置远程连接
select host,user from user;
说明用户只能本地登录
mysql> update user set user.host='%'where user.user='root';
Query OK, 1 row affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
然后用我们的远程工具测试即可
版权归原作者 天才少年^_^ 所有, 如有侵权,请联系我们删除。