MySQL: Install MySQL and Start Use
Download MySQL
If you need MySQL8.1 or other versions, you can click here:
MySQL Community Downloads
Just click “Download” and execute the “.msi” file, and MySQL will installed on your PC.
Configure MySQL Server
First, we should configure the MySQL Server.
- Set the username and password.
- Assign the port number to the SQL Server. (Default: 3306)
Now, you can access the MySQL Server by localhost
or 127.0.0.1
.
Start Use SQL
Some tools can help us to operational MySQL Database:
MySQL Command Line Client
CMD
orPowerShell
MySQL Shell
Some Programming Language
Here we use the MySQL Command Line Client
to demonstrate.
Connect the Server
MySQL Command Line Client defaults connecting the MySQL Server so that you can enter the password directly.
If you use the CMD or PowerShell, you should execute the command first:mysql -u [username] -p
.
The default username is root
, so usually you can execute mysql -u root -p
to the next step.
But maybe you will meet some wrongs like “mysql不是内部或外部命令”. That’s because the system environment variables are not configured correctly. You can solve the problem in the following steps:
- Open the Windows menu and search “环境变量”.
- Find the “环境变量” in a new window.
- In the “系统变量” section, double-click the ‘Path’.
- Add your MySQL install path to here.
- Confirm your edit.
Try to Query
Now you can use the database normally!