赞
踩
- 华为开源镜像站
- https://mirrors.huaweicloud.com/
yum -y install wget #如没有安装wget则无法使用,以装,则直接省略该步~!
直接从官方下载#~耐心等待即可~-~-~
xz这个压缩包也是打包后再压缩,外面是xz压缩方式,里层是tar打包方式
#从华为镜像站下载mysql8.0压缩包,后缀为xz的压缩包,需要两步解压
- wget https://repo.huaweicloud.com/mysql/Downloads/MySQL-8.0/mysql-8.0.24-linux-glibc2.12-x86_64.tar.xz
- xz -d mysql-8.0.24-linux-glibc2.12-x86_64.tar.xz
- tar -xvf mysql-8.0.24-linux-glibc2.12-x86_64.tar
- #移动该文件到/usr/local/下,并将文件夹名称修改为mysql
- mv mysql-8.0.24-linux-glibc2.12-x86_64 /usr/local/mysql
- #在/usr/local/mysql目录下创建data目录
- mkdir /usr/local/mysql/data
- cd
创建mysql用户组和用户
cat /etc/group | grep mysql
cat /etc/passwd |grep mysql
groupadd mysql
useradd -r -g mysql mysql
更改mysql目录下所有的目录及文件夹所属的用户组和用户,以及权限
- chown -R mysql:mysql /usr/local/mysql
-
- chmod -R 755 /usr/local/mysql
检查该链接库文件有没有安装使用
- rpm -qa|grep libaio
- yum install libaio-devel.x86_64
yum -y install numactl
编译安装并初始化mysql,务必记住初始化输出日志末尾的密码~~红框为数据库管理员登入临时密码!!!
- cd /usr/local/mysql/bin
- ./mysqld --initialize --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql
vi /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data
port=3306
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
symbolic-links=0
max_connections=600
innodb_file_per_table=1
character_set_server=utf8
#
和安装mysql5.7差不多,但是要删除lower_case_table_names=1 ,要改为0,否则启动会报错Starting MySQL.. ERROR! The server quit without updating PID file (/usr/local/mysql/data/localhost.localdomain.pid).
/usr/local/mysql/support-files/mysql.server start
- ps -ef|grep mysql | grep -v grep
- ps -ef|grep mysqld | grep -v grep
添加软连接,并重启mysql服务
ln -s /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
ln -s /usr/local/mysql/bin/mysql /usr/bin/mysql
service mysql restart
输入临时密码
mysql -u root -p
#修改密码
alter user 'root'@'localhost' identified by '自定义';
#开放远程连接
use mysql;
update user set user.Host='%' where user.User='root';
select user, host from user;
ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '密码';
flush privileges;
quit
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld #将服务文件拷贝到init.d下,并重命名为mysql
chmod +x /etc/init.d/mysqld #赋予可执行权限
chkconfig --add mysqld #添加服务
chkconfig --list ##显示服务列表
下载并安装MySQL官方的 Yum Repository
wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
安装MySQL
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
yum -y install mysql mysql-server mysql-devel
systemctl start mysqld.service
systemctl status mysqld.service
查看日志文件中找出随机密码
grep "password" /var/log/mysqld.log
修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
Mxd@123456
开发远程访问
grant all privileges on *.* to 'root'@'%' identified by ' 123456' with grant option;
flush privileges;
exit;
vi /etc/my.cnf,添加下面的内容,支持弱口令密码
character_set_server=utf8
init_connect='SET NAMES utf8'
#添加validate_password_policy配置
validate_password_policy=0
#关闭密码策略
validate_password = off
显示字符编码
show variables like '%character%';
显示密码策略
show variables like '%password%';
MySQL数据库服务是一个完全托管的数据库服务,可使用世界上最受欢迎的开源数据库来部署云原生应用程序。 它是百分百由MySQL原厂开发,管理和提供支持。
MySQL关系型数据库管理系统,由瑞典MySQL AB 公司开发,属于 Oracle旗下产品。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。