华为云x86架构下部署mysql
- 1. 配置X86架构ESC
- 2. 查看本系统中有没有安装mariadb相关的组件,有则卸载
- 3. 安装mysql
- 4. 启动mysql
- 5. 登录MySQL,修改密码,开放访问权限
1. 配置X86架构ESC
2. 查看本系统中有没有安装mariadb相关的组件,有则卸载
查找是否安装mariadb组件
rpm -qa | grep mariadb
删除组件
rpm -e mariadb-libs –nodeps
再次查看
rpm -qa | grep mariadb
3. 安装mysql
mysql安装包链接:link
将mysql相关的安装包,上传到华为云的ECS中(这里用的是WinSCP远程传输)
创建存储配置文件的目录
mkdir /usr/local/mysql
解压压缩包到新的目录中
tar -zxvf mysql-5.7.25-1.el7.x86_64.rpm-bundle.tar.gz -C /usr/local/mysql
按照顺序依次安装相关软件
cd /usr/local/mysql
rpm -ivh mysql-community-common-5.7.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-devel-5.7.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-5.7.25-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.25-1.el7.x86_64.rpm
yum install net-tools
yum install libaio
rpm -ivh mysql-community-server-5.7.25-1.el7.x86_64.rpm
4. 启动mysql
查看Mysql服务状态
systemctl status mysqld
启动mysql服务
systemctl start mysqld
开机自启动 mysqld服务
Systemctl enable mysqld
5. 登录MySQL,修改密码,开放访问权限
查看临时密码
cat /var/log/mysqld.log | grep password
登录MySQL
Mysql -uroot -p’初始密码’
修改密码长度最低位数
set global validate_password_length=4;
设置密码安全等级低
set global validate_password_policy=LOW;
设置密码为root
set password = password('root');
开启访问权限
grant all on *.* to 'root'@'%' identified by 'root';
flush privileges;
测试,创建一个新的数据库
create database 数据库名;