CentoS7安装MySQL

9 篇文章 0 订阅

下载MySQL8
在这里插入图片描述
在这里插入图片描述
复制链接

[root@localhost /]# wget https://dev.mysql.com/get/mysql80-community-release-el7-2.noarch.rpm
[root@localhost /]# yum -y localinstall mysql80-community-release-el7-2.noarch.rpm
[root@localhost /]#  yum -y install mysql-community-server

安装完成后启动MySQL服务

[root@localhost /]# systemctl start mysqld

设置开机启动

[root@localhost /]# systemctl enable mysqld
[root@localhost /]# systemctl daemon-reload

获取MySQL初始密码

[root@localhost /]# cat /var/log/mysqld.log
2019-04-11T13:01:02.341577Z 0 [System] [MY-013169] [Server] /usr/sbin/mysqld (mysqld 8.0.15) initializing of server in progress as process 7639
2019-04-11T13:01:04.351182Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: .IjaR)gfD3tj
2019-04-11T13:01:05.195421Z 0 [System] [MY-013170] [Server] /usr/sbin/mysqld (mysqld 8.0.15) initializing of server has completed
2019-04-11T13:01:07.376550Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.15) starting as process 7687
2019-04-11T13:01:07.799335Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-04-11T13:01:07.829999Z 0 [System] [MY-010931] [Server] /usr/sbin/mysqld: ready for connections. Version: '8.0.15'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server - GPL.
2019-04-11T13:01:07.926422Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060

MySQL初始密码为:.IjaR)gfD3tj
登录MySQL

[root@localhost /]# mysql -u root -p
Enter password: 

输入初始密码登录
修改登录密码

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'XXXXX';
Query OK, 0 rows affected (0.02 sec)
mysql>

XXXXX为设置的密码;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值