Linux服务器安装MySQL8.0
服务器安装MySQL
【Linux服务器安装MySQL8.0】服务器使用CentOS7
数据库安装
- 检查是否有安装MySQL
yum list installed | grep mysql
- 下载MySQL安装包,这里下载的是8.0
wget https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm
- 使用yum安装rpm包
yum -y install mysql80-community-release-el7-2.noarch.rpm
- 安装MySQL服务,过程比较慢,需要下载
yum -y install mysql-community-server
- 启动MySQL服务,记得是mysqld
systemctl start mysqld.service
- 查看MySQL运行状态
systemctl status mysqld.service● mysqld.service - MySQL Server Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled) Active: active (running) since 三 2021-07-28 16:44:56 CST; 1min 26s ago Docs: man:mysqld(8) http://dev.mysql.com/doc/refman/en/using-systemd.html Process: 17913 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS) Main PID: 18001 (mysqld) Status: "Server is operational" CGroup: /system.slice/mysqld.service └─18001 /usr/sbin/mysqld7月 28 16:44:47 VM-12-5-centos systemd[1]: Starting MySQL Server... 7月 28 16:44:56 VM-12-5-centos systemd[1]: Started MySQL Server.
- 重启/停止服务
service mysqld restart#重新启动Mysql systemctl stop mysqld.service#停止Mysql
- 查看MySQL的root用户初始密码
grep "password" /var/log/mysqld.log2021-07-28T08:44:50.767029Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: r!FYj6ujDhx%
- 登录root用户
mysql -u root -p
- 修改root密码
# 可以先设置允许简单密码set global validate_password.policy=0; set global validate_password.length=4; # 修改密码ALTER USER 'root'@'localhost' IDENTIFIED BY '你的密码';
- 关闭yum自动更新
yum -y remove mysql80-community-release-el7-2.noarch
客户端远程操作数据库
- 查看是否开启了3306端口
我的服务器是腾讯云,所以在控制台配置端口就行了,如果不是可以自行百度
- MySQL设置允许远程登录
USE mysql; UPDATE USER SET host = '%' WHERE USER = 'root'; FLUSH PRIVILEGES;
- 然后使用客户端登录即可
推荐阅读
- Mac安装Chromedriver
- MongoDB,Wondows下免安装版|MongoDB,Wondows下免安装版 (简化版操作)
- MAC安装Mongo
- Linux下面如何查看tomcat已经使用多少线程
- Beego打包部署到Linux
- 【Hadoop踩雷】Mac下安装Hadoop3以及Java版本问题
- 探索免费开源服务器tomcat的魅力
- react|react 安装
- VueX--VUE核心插件
- python-安装sublime遇到异常