MySQL Installation and Setup
You need a MySQL server on your computer to practise. There are two easy ways.
Option 1: XAMPP (easiest for beginners)
- Download XAMPP from apachefriends.org and install it.
- Open the XAMPP Control Panel and click Start next to MySQL (and Apache).
- Open
http://localhost/phpmyadminin your browser. This is a web tool to work with MySQL.
In XAMPP the user is root and the password is empty. This is only for your own computer.
Option 2: MySQL Installer
- Download MySQL Community Server from mysql.com (Windows installer, or use your package manager on Mac and Linux).
- During setup you choose a password for the
rootuser. Remember it. - You can also install MySQL Workbench, a visual tool.
Connect from the command line
mysql -u root -p
Enter the password when asked. You will see the mysql> prompt. Every SQL command ends with a semicolon.
SELECT VERSION();
Result (your version can be different)
| VERSION() |
|---|
| 8.0.36 |
SHOW DATABASES;
Result (your list can be different)
| Database |
|---|
| information_schema |
| mysql |
| performance_schema |
| sys |
Using phpMyAdmin
In phpMyAdmin click the SQL tab, type a command in the box, and press Go. Use it for all the examples of this tutorial.
Note:
Do not use the empty root password on a real server. Create a separate user with a strong password for each application.
Summary
- Install XAMPP or the MySQL Server.
- Use phpMyAdmin or the
mysqlcommand line to run SQL. - Next: MySQL Data Types.
Congratulations! Chapter Finished. Learn more about the similar topics:
| Exercises & Assignments |
|---|
| No Content Found. |
| Interview Questions & Answers |
|---|
| No Content Found. |