linux 上安装mysql

1. 下载源:wget https://xxx。

  例如:wget https://repo.mysql.com//mysql80-community-release-el8-3.noarch.rpm

 2. 安装源:yum install xxx.rpm。

 例如:yum install mysql80-community-release-el8-3.noarch.rpm -y

3. 安装mysql:yum install mysql-community-server

4 数据库服务端管理命令。

centos7版本:systemctl start|stop|restart|status mysqld。

5 查看mysql服务是否启动成功。

ps -aux|grep mysql

6. 查看mysql的root用户密码。

cat /var/log/mysqld.log |grep password

7. 客户端本地连接mysql:mysql -uroot -p。

8.本地连接完整命令:mysql -uroot -hlocalhost -P3306 -p。

9. 数据库连接成功后,此时使用的是临时密码,无法进行任何操作,需要修改root用户的密码。

alter user root@localhost identified with mysql_native_password by '你的密码';

10. 退出数据库客户端连接的方式:exit、quit、\q、快捷键ctrl+d。

 

posted @ 2022-08-04 16:21  zhangsima  阅读(247)  评论(0编辑  收藏  举报