ubuntu 18.1 安装 MySQL 5.7.25

本文介绍了如何在Ubuntu 18.10上安装MySQL 5.7.25。步骤包括更新系统包索引、安装mysql-server、配置MySQL,以及查看和重置MySQL密码。安装过程中需要注意存储空间询问和MySQL安全设置的选择。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

主机系统:ubuntu18.10

安装MySQL版本:MySQL-5.7.25

ubuntu查看系统版本: 命令: sudo lsb_release -a

    

ubuntu 18.1 安装 MySQL

目录

ubuntu 18.1 安装 MySQL

1.更新系统包索引  命令: sudo apt-get update

2.开始安装mysql  命令:  sudo apt-get install mysql-server

3.配置完成

4.查看MySQL的状态  命令  sudo service mysql status

5.登录MySQL 命令:mysql -u root -p

6.重置MySQL密码 命令:(需进入MySQL)SET PASSWORD FOR root@'localhost' = PASSWORD('newpassword');


  •     1.更新系统包索引  命令: sudo apt-get update

    

  •     2.开始安装mysql  命令:  sudo apt-get install mysql-server

        注意: 上面命令执行后, 会出现存储空间使用允许的询问,输入  Y  就可以继续安装了。

    

 

#1

VALIDATE PASSWORD PLUGIN can be used to test passwords...

Press y|Y for Yes, any other key for No: N (我的选项)

#2

Please set the password for root here...

New password: (输入密码)

Re-enter new password: (重复输入)

#3

By default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them...

Remove anonymous users? (Press y|Y for Yes, any other key for No) : Y (我的选项)   # 若对mysql 不熟悉,建议选N(这样只要在命令行输入MySQL,就可以进入MySQL了。)

#4

Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess atthe root password from the network...

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : N (我的选项)  #  我需要远程使用root目录,建议选Y(基于安全)。

 

#5

By default, MySQL comes with a database named 'test' thatanyone can access...

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : N (我的选项)

#6

Reloading the privilege tables will ensure that all changesmade so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y (我的选项) 

  • 3.配置完成

       

  • 4.查看MySQL的状态  命令  sudo service mysql status

        active(running)就是正常运行的

      

  • 5.登录MySQL 命令:mysql -u root -p

    再输入密码就好了(输入密码屏幕是不会显示输入字符的)

    

  • 6.重置MySQL密码 命令:(需进入MySQL)SET PASSWORD FOR root@'localhost' = PASSWORD('newpassword');

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值