赞
踩
下载地址为:https://obs.cn-north-4.myhuaweicloud.com/obs-mirror-ftp4/database/mysql-5.7.27-aarch64.tar.gz
1. 添加mysql用户组和mysql用户,用于隔离mysql进程
[root@arm ~]# groupadd -r mysql && useradd -r -g mysql -s /sbin/nologin -M mysql
2.安装依赖库
[root@arm ~]# yum install -y libaio*
3. 下载解压Mysql
[root@arm ~]# wget https://obs.cn-north-4.myhuaweicloud.com/obs-mirror-ftp4/database/mysql-5.7.27-aarch64.tar.gz
[root@arm ~]# tar -xvf mysql-5.7.27-aarch64.tar.gz -C /usr/local/
4.配置Mysql
[root@arm ~]# mv /usr/local/mysql-5.7.27-aarch64 /usr/local/mysql
[root@arm ~]# mkdir -p /usr/local/mysql/logs
[root@arm ~]# chown -R mysql:mysql /usr/local/mysql
[root@arm ~]# ln -sf /usr/local/mysql/my.cnf /etc/my.cnf
[root@arm ~]# cp -rf /usr/local/mysql/extra/lib* /usr/lib/
# 设置开机启动
[root@arm ~]# cp -rf /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
[root@arm ~]# chmod +x /etc/init.d/mysqld
[root@arm ~]# systemctl enable mysqld
5. 添加环境变量
[root@ecs-arm ~]# vi /etc/profile
export MYSQL_HOME=/usr/local/mysql
export PATH=$PATH:$MYSQL_HOME/bin
[root@ecs-arm ~]# source /etc/profile
6. 初始化启动mysql
无密码初始化登录
-------------------------------
[root@ecs-arm ~]# mkdir /usr/local/mysql/data
[root@ecs-arm ~]# chown -R mysql:mysql /usr/local/mysql/data
[root@ecs-arm ~]# mysqld --initialize-insecure --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
[root@ecs-arm ~]# systemctl start mysqld
[root@ecs-arm ~]# systemctl status mysqld
7 设置数据库root的密码
[root@ecs-arm ~]# mysql_secure_installation
8 登陆mysql
[root@ecs-arm ~]#/usr/local/mysql/bin/mysql -u root -p
9 修改密码为toot
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
如果遇到如下问题:
“
输入语句 “ SHOW VARIABLES LIKE 'validate_password%'; ” 进行查看初始密码策略,
首先需要设置密码的验证强度等级,设置 validate_password_policy 的全局参数为 LOW 即可,
输入设值语句 “ set global validate_password_policy=LOW; ” 进行设值
当前密码长度为 8 ,如果不介意的话就不用修改了,按照通用的来讲,设置为 6 位的密码,设置 validate_password_length 的全局参数为 4 即可,
输入设值语句 “ set global validate_password_length=4; ” 进行设值,
然后重新设置root密码:
grant all privileges on *.* to 'root'@'%' identified by 'root' with grant option;
保存设置:
Flush privileges;
7,使用navicat,连接,用户名密码都为root,端口号为3306.
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。