Linux MySQL80安装(云服务器同样适用)

云服务器 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!!!成功!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值