当前位置:网站首页>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
边栏推荐
- Sword finger offer 12 Path in matrix
- MySQL constraints
- Resolved (error in viewing data information in machine learning) attributeerror: target_ names
- 【R】 [density clustering, hierarchical clustering, expectation maximization clustering]
- Slf4j log facade
- [Database Principle and Application Tutorial (4th Edition | wechat Edition) Chen Zhibo] [Chapter 6 exercises]
- Introduction to the implementation principle of rxjs observable filter operator
- MySQL
- rxjs Observable filter Operator 的实现原理介绍
- CVPR 2022 图像恢复论文
猜你喜欢
OpenHarmony应用开发之ETS开发方式中的Image组件
Flink SQL knows why (XIV): the way to optimize the performance of dimension table join (Part 1) with source code
The 35 required questions in MySQL interview are illustrated, which is too easy to understand
Mysql database basic operation - regular expression
解决 System has not been booted with systemd as init system (PID 1). Can‘t operate.
The principle of human voice transformer
用户和组命令练习
MySQL constraints
Logseq evaluation: advantages, disadvantages, evaluation, learning tutorial
stm32和电机开发(从mcu到架构设计)
随机推荐
显卡缺货终于到头了:4000多块可得3070Ti,比原价便宜2000块拿下3090Ti
106. 如何提高 SAP UI5 应用路由 url 的可读性
C graphical tutorial (Fourth Edition)_ Chapter 15 interface: interfacesamplep268
Kotlin - 改良装饰者模式
The difference between session and cookie
解决 System has not been booted with systemd as init system (PID 1). Can‘t operate.
Flink code is written like this. It's strange that the window can be triggered (bad programming habits)
35道MySQL面试必问题图解,这样也太好理解了吧
C graphical tutorial (Fourth Edition)_ Chapter 20 asynchronous programming: examples - using asynchronous
[Database Principle and Application Tutorial (4th Edition | wechat Edition) Chen Zhibo] [Chapter IV exercises]
rxjs Observable filter Operator 的实现原理介绍
sitesCMS v3.0.2发布,升级JFinal等依赖
R语言gt包和gtExtras包优雅地、漂亮地显示表格数据:nflreadr包以及gtExtras包的gt_plt_winloss函数可视化多个分组的输赢值以及内联图(inline plot)
mysql更新时条件为一查询
Introduction to the implementation principle of rxjs observable filter operator
Task6: using transformer for emotion analysis
Seven habits of highly effective people
阿南的疑惑
Detailed explanation of multithreading
Sword finger offer 11 Rotate the minimum number of the array