VMware中Ubuntu_20.04安装配置mysql

1.安装

更新包列表

sudo apt update

安装mysql服务端

sudo apt install mysql-server

 安装mysql客户端

sudo apt-get install mysql-client

2.设置安全组件

设置安全组件

sudo mysql_secure_installation

询问是否配置安全组件,选择y

Securing the MySQL server deployment.

Connecting to MySQL using a blank password.

VALIDATE PASSWORD COMPONENT can be used to test passwords
and improve security. It checks the strength of password
and allows the users to set only those passwords which are
secure enough. Would you like to setup VALIDATE PASSWORD component?

询问设置密码策略等级(通过增加密码复杂度提高安全),看个人选择

There are three levels of password validation policy:

LOW    Length >= 8
MEDIUM Length >= 8, numeric, mixed case, and special characters
STRONG Length >= 8, numeric, mixed case, special characters and dictionary                  file

Please enter 0 = LOW, 1 = MEDIUM and 2 = STRONG: 

询问是否删除匿名用户(匿名用户为了测试用,删掉即可),选择y

By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : 

询问是否允许远程root登录,看个人选择(我选择y)

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

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : 

询问是否删除test数据库(test数据库用于测试,删掉即可),选择y

 ... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.


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

询问是否重启(重启生效配置),选择y

Reloading the privilege tables will ensure that all changes 
made so far will take effect immediately. 
 
Reload privilege tables now? (Press y|Y for Yes, any other key for No) :

测试mysql运行状态

sudo systemctl status mysql.service
● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset:>
     Active: active (running) since Tue 2024-01-30 22:32:09 CST; 11min ago
    Process: 794 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=ex>
   Main PID: 976 (mysqld)
     Status: "Server is operational"
      Tasks: 38 (limit: 4556)
     Memory: 430.8M
     CGroup: /system.slice/mysql.service
             └─976 /usr/sbin/mysqld

3.设置root用户密码

无密码登录mysql(刚安装好,root用户没有密码,能够直接登录)

sudo mysql -u root -p

修改root用户的密码(如果不符合密码策略规定,按照设置要求设置密码,或者更改密码策略)

ALTER user 'root'@'localhost' IDENTIFIED BY 'password';

刷新用户权限

flush privileges;

退出登录重试

exit;

如有错误,请大佬们多多指教(抱拳)。

  • 6
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
很抱歉,我无法访问和引用链接的内容。但是,我可以为您提供一般的步骤来在VMware安装Ubuntu 20.04。 1. 首先,您需要下载并安装VMware Workstation或VMware Player。这是一款虚拟机软件,可以让您在计算机上运行其他操作系统。 2. 在VMware创建一个新的虚拟机。您可以选择自定义设置,然后按照向导的指示进行操作。 3. 在创建虚拟机时,选择安装操作系统。在这里,您可以选择使用ISO镜像文件安装Ubuntu 20.04。您可以从Ubuntu官方网站上下载最新的Ubuntu 20.04 ISO镜像文件。 4. 完成虚拟机的设置后,启动虚拟机并选择安装Ubuntu。按照安装向导的指示进行操作,包括选择语言、键盘布局和磁盘分区等。 5. 在安装过程,您需要提供一些基本信息,例如用户名、密码等。 6. 完成安装后,重新启动虚拟机,并登录到Ubuntu 20.04。 这些是一般的步骤,您可以根据您的具体情况进行调整。希望对您有所帮助! #### 引用[.reference_title] - *1* [【Ubuntu】在VMWare虚拟机安装Ubuntu20.04【教程】](https://blog.csdn.net/qq_44940689/article/details/128686126)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值