当前位置:网站首页>Ubuntu系统安装与配置MySQL
Ubuntu系统安装与配置MySQL
2022-07-01 09:37:00 【伊木子曦】
一、安装MySQL
1. 安装mysql服务
sudo apt-get updatesudo apt install mysql-server-5.72. mysql版本
mysql -V3. 查看MySQL默认账号和密码
sudo cat /etc/mysql/debian.cnf二、配置MySQL
sudo mysql_secure_installation#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 have
a user account created for them...
Remove anonymous users? (Press y|Y for Yes, any other key for No) : N
#4
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) : N
#5
By default, MySQL comes with a database named 'test' that
anyone 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 changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : Y 三、查看mysql服务状态
systemctl status mysql.service ps -ef|grep mysqld四、修改root账户秘密认证方式
sudo cat /etc/mysql/debian.cnfpassword后面的就是密码
然后在命令行输入:
mysql -u debian-sys-maint -p- 在出现的Enter password输入上面的密码 ,进入mysql命令模式
- 创建数据库,修改密码
use mysql;
update mysql.user set authentication_string=('password') where user='root' and Host ='localhost';
update user set plugin="mysql_native_password";
flush privileges;
quit;五、配置远程访问mysql
1.修改配置文件,注释掉bind-address = 127.0.0.1
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf2. 保存退出,进入mysql
mysql -uroot -pmysql> use mysql;
mysql> update user set host='%' where user = 'root';
mysql> flush privileges;重启
sudo service mysql restart查看状态
systemctl status mysql.service六、删除MySQL
删除 mysql:
sudo apt autoremove --purge mysql-server-*
sudo apt remove mysql-server
sudo apt autoremove mysql-server
sudo apt remove mysql-common清理残留数据
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
边栏推荐
- 奇怪,为什么ArrayList初始化容量大小为10?
- SQL学习笔记(02)——数据库表操作
- dotnet 控制台 使用 Microsoft.Maui.Graphics 配合 Skia 进行绘图入门
- Implementation and application of queue
- Network partition notes
- IPv6 learning notes
- Clickhouse: Test on query speed of A-share minute data [Part 2]
- 数据中台咋就从“小甜甜”变成了“牛夫人”?
- 微信小程序 webview 禁止页面滚动,同时又不影响业务内overflow的滚动的实现方式
- Exception handling of classes in C #
猜你喜欢

2.3 【kaggle数据集 - dog breed 举例】数据预处理、重写Dataset、DataLoader读取数据

云原生到底是什么?它会是未来发展的趋势吗?

Implementation and application of queue

Structure de l'arbre - - - arbre binaire 2 traversée non récursive

How to launch circle of friends marketing and wechat group activities

OSPF - virtual link details (including configuration commands)

Swift control encapsulation - paging controller

Installation and use of NoSQL database

nacos服务配置和持久化配置

Mise en œuvre simple de l'équilibrage de la charge par nacos
随机推荐
js this丢失问题分析 及 解决方案
集成积木报表报错 org.apache.catalina.core.StandardContext.filterStart 启动过滤器异常
Rich text interpolation
Flinkv1.13 implementation of financial anti fraud cases
2.3 【pytorch】数据预处理 torchvision.datasets.ImageFolder
【电赛训练】红外光通信装置 2013年电赛真题
树结构---二叉树2非递归遍历
嵌入式开发用到的一些工具
Installation and use of NoSQL database
【pytorch】nn. AdaptiveMaxPool2d
JS rewrite their own functions
Differences between JS valueof and toString
2.3 【kaggle数据集 - dog breed 举例】数据预处理、重写Dataset、DataLoader读取数据
SQL learning notes (01) - basic knowledge of database
How to realize the usage of connecting multiple databases in idel
phpexcel 里 获取某一列的列表 获取某一列的字母
Concept of digital currency
SQL学习笔记(03)——数据约束关系
ES6-const本质与完全不可改实现(Object.freeze)
【leetcode】287. Find duplicates