1. Stop and start of service
MySQL After installation , The server process needs to be started , Otherwise, the client cannot connect to the database .
--- Run as Administrator windows command prompt , Otherwise, access will be denied :
# start-up MySQL Service command net start MySQL service name # stop it MySQL Service command net stop MySQL service name
1.MySQL The service is in a stopped state :
2. start-up MySQL service :
3.MySQL The service is in a started state :
start and stop The following service name should be consistent with the service name specified when configuring environment variables .
2. Login and exit
format :
mysql -h host name -P Port number -u user name -p password
give an example :
mysql -h localhost -P 3306 -u root -pabc123 # Previously set root The user's password is abc123
Login successful :
There is a warning here , Just change the method of password input :
Exit instruction :
be careful :
(1)-p No space is allowed between and password , There may or may not be spaces between other parameter names and parameter values . as :
mysql -hlocalhost -P3306 -uroot -pabc123
(2) It is recommended to enter the password on the next line , Ensure safety .
(3) The client and server are on the same machine , So input localhost perhaps IP address 127.0.0.1. meanwhile , Because it is connected to this machine :
-hlocalhost It can be omitted , If the port number is not modified :-P3306 It can also be omitted .
You can log in through :
mysql -V
perhaps
mysql --version
Acquisition method MySQL Server Service version information .
After landing, pass
select version();
View current version information .
Technology
Daily Recommendation