Python之Web开发中级教程----ubuntu安装MySQL

Python之Web开发中级教程----ubuntu安装MySQL

  1. 进入/opt目录

cd /opt

  1. 更新软件源

sudo apt-get upgrade

sudo apt-get update

3、安装Mysql server

sudo apt-get install mysql-server

4、启动Mysql

service mysql start

5、确认Mysql的状态

service mysql status

6、安全设置(设置root密码,移除匿名用户,禁止root远程访问等):

MySQL安装随附一个名为的脚本mysql_secure_installation,可让您轻松提高数据库服务器的安全性。

调用不带参数的脚本:

sudo mysql_secure_installation

系统将要求您配置VALIDATE PASSWORD PLUGIN用来测试MySQL用户密码强度并提高安全性的密码:

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?

Press y|Y for Yes, any other key for No: y

密码验证策略分为三个级别:低,中和强。按下y如果你想设置的验证密码插件或任何其他键移动到下一个步骤:

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: 2

在下一个提示符下,将要求您设置MySQL root用户的密码:

Please set the password for root here.

New password:

Re-enter new password:

如果您设置了验证密码插件,该脚本将向您显示新密码的强度。键入y以确认密码:

Estimated strength of the password: 50

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y

接下来,将要求您删除匿名用户,限制root用户对本地计算机的访问,删除测试数据库并重新加载特权表。您应该回答y所有问题。

7、安装Mysql客户端

sudo apt-get install mysql-client /// 客户端

8、安装开发接口

sudo apt-get install libmysqlclient-dev /// 开发接口

9、登入mysql

Sudo mysql -u root -p

相关推荐
必须会一定会1 小时前
Agent Plugins 1.0实战:plugin.json、skills、mcp.json目录结构与迁移
开发语言·人工智能·ai编程
Linux-lucky1 小时前
21-Linux学习之旅之HTTPS和安全加固
linux·运维·学习·ubuntu·https
St_rive1 小时前
Page Object设计模式
java·开发语言·设计模式
CTA量化套保1 小时前
近期零基础量化学习:先分阶段,再用 AI 检查缺口
人工智能·python
wp123_12 小时前
硬件元器件笔记|IPX8 防水 Type‑C 母座安费诺 124018802112A 与 TONEVEE TY48086‑24A 分析
c语言·开发语言·笔记
wuyk5552 小时前
4.树:一对多的层次数据结构
开发语言·数据结构·stm32·单片机
清水白石0082 小时前
Python 死锁排查全攻略:从线程卡死到锁依赖定位与工程化修复
linux·网络·python
杨运交2 小时前
[060][调度模块]Redisson vs Redis 原生锁:两种分布式锁实现深度对比
数据库·redis·分布式
FungLeo2 小时前
Node 后端实战 · 列表查询到底怎么写?一个通用 DSL 封装,过滤分页排序一次搞定
数据库·node.js·serverless·dsl 封装·通用列表查询
Elias不吃糖2 小时前
Langfuse 入门:Trace、Prompt、Dataset、Experiment、Evaluator
前端·python·prompt·langfuse