Linux 安装MySql8.0.*

4 篇文章 0 订阅
3 篇文章 0 订阅

Linux 安装MySql8.0.*
安装mysql源

yum localinstall https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

安装mysql

yum install mysql-community-server

安装mysql的开发包,以后会有用

yum install mysql-community-devel

启动mysql

systemctl start mysqld.service

查看mysql启动状态
在这里插入图片描述
出现pid
证明启动成功
获取mysql默认生成的密码

grep 'temporary password' /var/log/mysqld.log

在这里插入图片描述

选中的就是密码。
换成自己的密码

mysql -uroot -p
Enter password:输入上页的密码,右键复制粘贴下来就可以了,进入mysql

更换密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'yourPassWord4!';

这个密码一定要足够复杂,不然会不让你改,提示密码不合法;大小写加数字加符号
退出mysql并试用下新密码,命令quit;

mysql> quit;

再连接测试下密码

mysql -uroot -p

确认密码正确
到此,mysql安装成功。

mysql 开启远程登录访问。
首先,确认你的服务器是否开启3306端口,若开启,登录mysql

[root@~ /]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 39
Server version: 5.7.24 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.
mysql> use mysql;
Database changed
mysql> grant all privileges  on *.* to root@'%' identified by "password";
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> select host,user,password from user;
+--------------+------+-------------------------------------------+
| host         | user | password                                  |
+--------------+------+-------------------------------------------+
| localhost    | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E |
| 192.168.1.1 | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E |
| %            | root | *A731AEBFB621E354CD41BAF207D884A609E81F5E |
+--------------+------+-------------------------------------------+
3 rows in set (0.00 sec)

此时,远程访问就开启成功了

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值