阿里云服务器ECS安装配置mysql
我安装的是8.0版本的。
1.从mysql官网上https://dev.mysql.com/downloads/repo/yum/ 下载 mysql80-community-release-el7-1.noarch.rpm ;
2.通过命令 yum install mysql80-community-release-el7-1.noarch.rpm 结尾出现complete,表示安装mysql源完成。
3.通过命令 # yum repolist enabled | grep "mysql.*-community.*" 查看mysql源安装情况。
mysql-connectors-community/x86_64 MySQL Connectors Community 51
mysql-tools-community/x86_64 MySQL Tools Community 63
mysql80-community/x86_64 MySQL 8.0 Community Server 17
4.通过命令 # yum install mysql-community-server 安装mysql;结尾出现complete,表示安装mysql完成。
5.通过命令 # rpm -aq | grep -i mysql 查看mysql安装版本。
6.通过命令 # systemctl restart mysqld 启动mysql服务。
7.通过命令 # grep 'A temporary password' /var/log/mysqld.log 查看mysql原始密码。
[MY-010454] [Server] A temporary password is generated for [email protected]: p/Klv+ifX9%e
8.通过命令 # mysql -uroot -pp/Klv+ifX9%e 链接mysql。出现下面情况,表示连接成功。
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 8.0.11 MySQL Community Server - GPL
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
9.通过命令 use mysql;切换到mysql数据库。
10.通过mysql语句 ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456'; 修改成新密码。(注意这种修改密码方法是针对mysql 8.0B版本的,否则客户端连接时会出现1205错误)
11.将mysql修改为允许远程连接;通过mysql语句 update user set host=% where user=root and host=localhost;
12.让配置生效,通过mysql语句 flush privileges;
13.通过命令 #systemctl enable mysqld 设置mysql为开机启动。
14.最后在阿里云服务器添加MySQL的安全组
上一篇: DES加密和解密
下一篇: 在阿里云服务器上安装配置node和npm