当前位置:网站首页>MySQL installation, uninstallation, initial password setting and general commands of Linux
MySQL installation, uninstallation, initial password setting and general commands of Linux
2022-07-03 13:19:00 【Levi Bebe】
1. install MySQL
Update source and install MySQL:
sudo apt-get update # Update source
sudo apt-get install mysql-server # install mysql
Check MySQL Is the installation successful :
because mysql After installation , It will start automatically, so you can check the running status , Verify that the installation was successful .
systemctl status mysql ## see mysql state
systemctl Use of commands and view of service status 
mysql --version ## see mysql edition

It can be verified by the above two methods mysql Is the installation successful .
2. uninstall MySQL
sudo rm /var/lib/mysql/ -R # Delete database directory
sudo rm /etc/mysql/ -R # Delete startup script 、 Configuration files, etc
sudo apt-get autoremove mysql* --purge # uninstall mysql All the files
sudo apt-get remove apparmor # This apparmor It's pretending mysql-server In fashion , Safety related
dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P # Clean up the residue mysql file
3. Check the initial account and password
3.1 Check the initial account and password
Because when installing , No password set ,mysql The account and password will be automatically generated , Use the following command to view :
sudo cat /etc/mysql/debian.cnf
result :
3.2 Change account and password
1. Use the initialization account password to enter mysql, Everyone's initialization password is different :
mysql -u debian-sys-maint -p
Successfully logged in , Here's the picture :
2. Set up root Password :
user Medium root It's an account ,password It's a password :bianbian123
update mysql.user set authentication_string=password("88888888"),plugin='mysql_native_password' where user='root';
The results are shown in the following figure :
3. sign out mysql
flush privileges; # Hit enter , Update and modify
quit; # Hit enter , sign out

4. restart mysql, And login
restart :
systemctl restart mysql
Sign in :
mysql -u root -p88888888

4. Normal operation
systemctl start mysql # Turn on mysql
systemctl stop mysql # stop it mysql
systemctl restart mysql # restart mysql
systemctl status mysql # mysql Running state
Reference resources :
https://blog.csdn.net/cruiserblog/article/details/106934570
https://www.it610.com/article/1304140137831108608.htm
http://www.manongjc.com/detail/11-tzeibqtfcoijnye.html
https://www.cnblogs.com/benjamin77/p/8681763.html
https://www.cnblogs.com/cpl9412290130/p/9583868.html
边栏推荐
- sitesCMS v3.1.0发布,上线微信小程序
- SSH登录服务器发送提醒
- Resolved (error in viewing data information in machine learning) attributeerror: target_ names
- Useful blog links
- JS 将伪数组转换成数组
- 服务器硬盘冷迁移后网卡无法启动问题
- 【R】 [density clustering, hierarchical clustering, expectation maximization clustering]
- Logback 日志框架
- 106. 如何提高 SAP UI5 应用路由 url 的可读性
- mysql更新时条件为一查询
猜你喜欢

Servlet

When we are doing flow batch integration, what are we doing?

This math book, which has been written by senior ml researchers for 7 years, is available in free electronic version

Today's sleep quality record 77 points

Idea full text search shortcut ctr+shift+f failure problem

STM32 and motor development (from MCU to architecture design)

剑指 Offer 14- II. 剪绳子 II

File uploading and email sending

(first) the most complete way to become God of Flink SQL in history (full text 180000 words, 138 cases, 42 pictures)

Flink SQL knows why (16): dlink, a powerful tool for developing enterprises with Flink SQL
随机推荐
【Colab】【使用外部数据的7种方法】
R语言gt包和gtExtras包优雅地、漂亮地显示表格数据:nflreadr包以及gtExtras包的gt_plt_winloss函数可视化多个分组的输赢值以及内联图(inline plot)
Flink SQL knows why (XI): weight removal is not only count distinct, but also powerful duplication
STM32 and motor development (from MCU to architecture design)
The principle of human voice transformer
剑指 Offer 17. 打印从1到最大的n位数
json序列化时案例总结
Servlet
[Database Principle and Application Tutorial (4th Edition | wechat Edition) Chen Zhibo] [Chapter IV exercises]
对业务的一些思考
道路建设问题
[Database Principle and Application Tutorial (4th Edition | wechat Edition) Chen Zhibo] [Chapter III exercises]
This math book, which has been written by senior ml researchers for 7 years, is available in free electronic version
Flick SQL knows why (10): everyone uses accumulate window to calculate cumulative indicators
rxjs Observable filter Operator 的实现原理介绍
Kotlin - improved decorator mode
R语言使用data函数获取当前R环境可用的示例数据集:获取datasets包中的所有示例数据集、获取所有包的数据集、获取特定包的数据集
[Database Principle and Application Tutorial (4th Edition | wechat Edition) Chen Zhibo] [Chapter V exercises]
An example of newtonjason
[colab] [7 methods of using external data]