当前位置:网站首页>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
边栏推荐
猜你喜欢

Flink SQL knows why (12): is it difficult to join streams? (top)

今日睡眠质量记录77分

【数据库原理及应用教程(第4版|微课版)陈志泊】【第三章习题】

正则表达式

剑指 Offer 14- II. 剪绳子 II

February 14, 2022, incluxdb survey - mind map

2022-02-14 incluxdb cluster write data writetoshard parsing

rxjs Observable filter Operator 的实现原理介绍

MySQL

Flink SQL knows why (7): haven't you even seen the ETL and group AGG scenarios that are most suitable for Flink SQL?
随机推荐
Multi table query of MySQL - multi table relationship and related exercises
Logseq evaluation: advantages, disadvantages, evaluation, learning tutorial
Sword finger offer 15 Number of 1 in binary
今日睡眠质量记录77分
C graphical tutorial (Fourth Edition)_ Chapter 15 interface: interfacesamplep271
Sword finger offer 12 Path in matrix
2022-02-09 survey of incluxdb cluster
Sword finger offer 17 Print from 1 to the maximum n digits
Fabric. JS three methods of changing pictures (including changing pictures in the group and caching)
35道MySQL面试必问题图解,这样也太好理解了吧
对业务的一些思考
Will Huawei be the next one to fall
Logback 日志框架
An example of newtonjason
rxjs Observable filter Operator 的实现原理介绍
Servlet
[colab] [7 methods of using external data]
When we are doing flow batch integration, what are we doing?
stm32和电机开发(从mcu到架构设计)
Task5: multi type emotion analysis