赞
踩
1.官网下载mysql安装包大约756M大小
2.将软件包上传到服务器
rz -be mysql-8.0.24-1.el7.x86_64.rpm-bundle.tar
3.检查服务器上是否安装了之前的mysql或者mariadb,如果有安装过则,进行卸载
检查安装过:
rpm -qa |grep mysql
rpm -qa |grep mariadb
进行卸载:
rpm -e 软件包,如果卸载不掉,则用yum卸载
yum -y remove mariadb-libs-5.5.65-1.el7.x86_64
4.解压压缩包,进行安装mysql,安装过程中缺少依赖包则进行安装依赖包
tar -xf mysql-8.0.24-1.el7.x86_64.rpm-bundle.tar -C /usr/local/mysql
rpm -ivh mysql-community-common-8.0.24-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.24-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.24-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.24-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.24-1.el7.x86_64.rpm
rpm -qa | grep mysql 查看是否已经安装
5.创建mysql用户组和mysql用户
groupadd mysql
useradd -g mysql mysql
6.通过以下命令,完成对 mysql 数据库的初始化和相关配置
chown -R mysql.mysql /usr/local/mysql/
systemctl start mysqld.service
systemctl enable mysqld
7.查看默认密码,进行登录,重新设置密码
grep password /var/log/mysqld.log
mysql -uroot -p
mysql> alter user root@‘localhost’ identified by ‘Sccin1qazCDE#’
ALTER USER ‘root’@’%’ IDENTIFIED WITH mysql_native_password BY ‘Ljtao2020!’;#修改root用户密码
GRANT ALL ON . TO ‘root’@’%’ ; #授权root用户可以远程登陆
flush privileges; #立即生效
8.设置my.cnf配置文件,需要什么要求设置什么配置
(1)不区分大小写
systemctl stop mysqld
vim /etc/my.cnf
lower_case_table_names = 1
保存
systemctl start mysqld
grep password /var/log/mysqld.log
mysql> alter user root@‘localhost’ identified by ‘Sccin1qazCDE#’
mysql> flush privileges;
mysql> show variables like “%case%”
-> ;
±-----------------------------------±------+
| Variable_name | Value |
±-----------------------------------±------+
| lower_case_file_system | OFF |
| lower_case_table_names | 1 |
| validate_password.mixed_case_count | 1 |
±-----------------------------------±------+
自此设置成功
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。