云服务器 Linux MySQL80安装、
步骤一:下载mysql的yum源配置
[root@hecs-79217 local]# wget http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
步骤二:安装mysql的yum源
[root@hecs-79217 local]# yum -y install mysql80-community-release-el7-3.noarch.rpm
步骤三:yum方式安装mysql
yum -y install mysql-server --nogpgcheck
#--nogpgcheck 不校验数字签名
步骤四:启动mysql
[root@hecs-79217 local]# systemctl start mysqld.service
[root@hecs-79217 local]# systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Sat 2022-11-12 15:30:29 CST; 13s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 26307 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 26385 (mysqld)
Status: "Server is operational"
CGroup: /system.slice/mysqld.service
└─26385 /usr/sbin/mysqld
命令行进入mysql,修改初始密码
查看临时密码
cat /var/log/mysqld.log| grep password
注:如果临时密码中含有具有转义的符号的话,请单独输入密码,如下形式
[root@hecs-79217 local]# mysql -uroot -p
Enter password:
修改root密码,5.7要求必须首先修改密码,不修改其他所有的命令不可以使用。
ALTER USER USER() IDENTIFIED BY '123456Admin@123';
#给其他机器授权能够访问mysql
mysql> grant all privileges on *.* to 'root'@'%' identified by '123456Admin@123' with grant option;
MySQL80后密码的校验规则更加严格,因此要修改校验策略后才能设置简单密码
逐条执行就可以了
mysql> set global validate_password.policy=0;
mysql> set global validate_password.length=6;
mysql> set global validate_password.check_user_name=OFF;
mysql> set global validate_password.mixed_case_count=0;
mysql> set global validate_password.number_count=0;
mysql> set global validate_password.special_char_count=0;
mysql> flush privileges;
#可以修改为简单密码了
mysql> ALTER USER USER() IDENTIFIED BY '123456';
测试远程连接
[root@hecs-79217 local]# mysql -h 源程服务器IP -uroot -p123456
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 9
Server version: 8.0.31 MySQL Community Server - GPL
Copyright (c) 2000, 2022, Oracle and/or its affiliates.
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.
mysql> quit
Bye
OK!!!成功!!!