MySQL is one of the most popular database systems available today. In this guide, we’ll walk you through how to install MySQL on Windows.
You can find an installer for the latest MySQL version on the Oracle MySQL Community website. The page should automatically detect your operating system, but if not, select Microsoft Windows and click ‘Go to Download Page’
You can choose either option—the first (smaller) installer file downloads MySQL packages during installation. The second (larger) file includes all of the packages. We recommend you choose the first option.
Once the file has downloaded, open it to begin installation. When prompted, choose a setup type. We recommend selecting ‘Custom’ and then specifying the packages you would like to install:
On the following screen, at minimum, select MySQL Server, MySQL Shell, and MySQL Documentation. You can also select any additional packages that you need.
When prompted, enter a root password for your MySQL server. You must note this password in order to make the initial connection:
At this point, if you left the ‘start MySQL Server after installation’ box checked, your MySQL server should already be running locally. If not, you can start it from the command line with this command:
"C:\Program Files\MySQL\MySQL Server 8.0\bin\mysqld"
Now, let’s connect! Open Arctype, press ‘Add New Connection’, and enter your connection information. For now, we’ll use the root
user with the password set during installation and the database mysql
:
Press Test Connection to confirm that all of your information is correct and then Save!
Now that you have connected, you should make a few changes to improve the security of your database. The first is to create a new database that is separate from the mysql informational database you are currently connected to. Click ‘New Query’ and run the following command:
CREATE DATABASE myDB
Next, you should create a new user:
CREATE USER ‘myUser’@’localhost’ IDENTIFIED BY ‘myPassword’
And finally, you’ll need to grant this user full permissions on your database:
GRANT ALL PRIVILEGES ON myDB.* TO ‘myUser’@’localhost’
Run FLUSH PRIVILEGES
to apply these permissions.
Go back to the settings menu in your SQL client and switch to this new user and database. You’re all ready to start writing queries!