openEuler RPM方式安装MySQL8的实现
李昊哲小课 人气:0升级系统内核和软件
yum -y update
安装常用软件
yum -y install lrzsz gcc gcc-c++ zlib zlib-devel openssl openssl-devel pcre-devel vim net-tools man wget tar
下载安装包
wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.31-1.el8.x86_64.rpm-bundle.tar
创建目录存储安装包
mkdir mysql
解压安装包到指定目录
tar -xvf mysql-8.0.31-1.el8.x86_64.rpm-bundle.tar -C mysql
保留最少安装文件
cd mysql rm -f *debug*
安装mysql
rpm -ivh *.rpm --force --nodeps
启动mysql
systemctl start mysqld
设置开机启动mysql
systemctl enable mysqld
查看初始密码
grep 'temporary password' /var/log/mysqld.log
登录mysql
mysql -h localhost -uroot -p
mysql环境清空屏幕
system clear
修改密码并授权可以访问主机
ALTER USER 'root'@'localhost' IDENTIFIED BY 'Lihaozhe!!@@1122'; flush privileges; ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'Lihaozhe!!@@1122'; flush privileges; update mysql.user set host = '%',plugin='mysql_native_password' where user='root'; flush privileges; quit;
重启mysql服务
systemctl restart mysqld
登录mysql
mysql -h 127.0.0.1 -uroot -p
查看字符集
show variables like'%character%';
编辑配置文件修改服务器端字符集
vim /etc/my.cnf #在[mysqld]下面增加 character-set-server=utf8mb4
重启mysql服务
systemctl restart mysqld
加载全部内容