1. Set and change the root password Check whether mysql is started. If not, run Run the mysql command, and the following will appear: Just add mysql to the environment variables: Temporarily add: Permanently add: Then run soucre /etc/profile or . /etc/profile Setting the mysql password, setting a password for the root user How to change your password: How to change the password if you forget it: First, you need to modify the configuration file: Add Restart: Then, switch the database: Then, modify the root password in the database: This will change the password back. To retest, change my.cnf back: 2. Connection to mysql mysql -uroot -p 'password' mysql -h127.0.0.1 -uroot -p 'password' mysql -S /tmp/mysql.sock -uroot -p'password' mysql -uroot -p -e "show databases" 3. Common mysql commands Check how many databases there are: show databases; Use a library: use database_name; Check how many tables there are: show tables; View the fields in a table: desc table_name: View the command entered when a table is created: show create table table_name\G; Check which users are currently logged in: select user(); Check which library is currently used: select database(); View the current database version: select version(); View the various parameters that can be defined in the configuration file: show variables; View the current number of processes: show processlist; or show full processlist; #This is the most commonly used (i.e., view the operations being performed by the database) Create a database: create Create a table: Create a table: create The first part is complete. Summarize The above is the editor's introduction to MySQL settings to change the root password, MySQL server connection, and illustrations of MySQL common commands. I hope it will be helpful to everyone. If you have any questions, please leave me a message and the editor will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website! You may also be interested in:
|
<<: Practical record of vue using echarts word cloud chart
>>: Detailed explanation of the update command for software (library) under Linux
Table of contents Basic Selector Extensions Attri...
This article shares a dynamic loading progress ba...
1. Download MySQL Click on the official website d...
In the latest version of Ubuntu, users no longer ...
This article shares the specific code of JavaScri...
9 great JavaScript framework scripts for drawing ...
The relationship between Tomcat logs A picture is...
In Node.js, a .js file is a complete scope (modul...
Download https://tomcat.apache.org/download-80.cg...
This article shares the MySQL precompilation func...
mysql copies the files in the data directory to r...
1. Introduction MySQL is used in the project. I i...
Prelude We all know that nginx is an excellent re...
Nginx: PV, UV, independent IP Everyone who makes ...
Physical Structure of an InnoDB Index All InnoDB ...