当前位置:网站首页>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
边栏推荐
- Closure implementation iterator effect
- SDN_ Simple summary
- 微信小程序 webview 禁止页面滚动,同时又不影响业务内overflow的滚动的实现方式
- Spark's action operator
- Class loading
- The market is relatively weak recently
- 利用闭包实现私有变量
- js valueOf 与 toString 区别
- PR training notes
- [ESP nanny level tutorial preview] crazy node JS server - Case: esp8266 + MQ Series + nodejs local service + MySQL storage
猜你喜欢
随机推荐
2022.02.15_ Daily question leetcode six hundred and ninety
Huawei accounts work together at multiple ends to create a better internet life
js原型陷阱
Niuke monthly race 22- collect pieces of paper
Dspic30f6014a LCD block display
JS prototype chain
2.3 [kaggle dataset - dog feed example] data preprocessing, rewriting dataset, dataloader reading data
【无标题】
Project procurement management
LVGL V8.2字符串显示在Keil MDK上需要注意的事项(以小熊派为例)
A 419 error occurred in the laravel postman submission form. July 6th, 2020 diary.
ESP8266 FreeRTOS开发环境搭建
Concept of digital currency
SQL learning notes (02) - database table operation
js valueOf 与 toString 区别
Day06 branch structure and cycle (III)
[ESP nanny level tutorial] crazy completion chapter - Case: temperature and humidity monitoring system based on Alibaba cloud, applet and Arduino
JS functionarguments object
【pytorch】softmax函数
Using closures to implement private variables








