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

相关推荐
无垠的广袤4 分钟前
【工业树莓派 CM0 NANO 单板计算机】YOLO26 部署方案
linux·python·opencv·yolo·树莓派·目标识别
董世昌414 分钟前
HTTP协议中,GET和POST有什么区别?分别适用什么场景?
java·开发语言·前端
独自破碎E5 分钟前
Java中HashMap的默认负载因子为什么设置为0.75?
java·开发语言·网络
STLearner5 分钟前
AAAI 2026 | 时间序列(Time Series) 论文总结[下] (分类,异常检测,基础模型,表示学习,生成)
大数据·论文阅读·人工智能·python·深度学习·机器学习·数据挖掘
幽络源小助理8 分钟前
SpringBoot+Vue大学城水电管理系统源码 | 后勤设备管理 | 幽络源
java·开发语言
闻林禹8 分钟前
c++并发编程
开发语言·c++
l1t9 分钟前
DeepSeek总结的SQLite 数据库的版本更新历史摘要
数据库·人工智能·sqlite
一个天蝎座 白勺 程序猿9 分钟前
Apache IoTDB(13):数据处理的双刃剑——FILL空值填充与LIMIT/SLIMIT分页查询实战指南
数据库·sql·ai·apache·时序数据库·iotdb
一步一个脚印10 分钟前
Oracle LONG类型与CLOB类型的比较与转换
数据库·oracle
科研鬼才(bushi12 分钟前
项目文件夹规范
python