Accessing MySQL through the command-line interface
MySQL is also accessible through your computer's command-line interface (CLI). This interface will allow you to quickly and easily run SQL queries against a database. The MySQL command line requires you to provide a username and password when you launch it. The -u
argument specifies the username, and the -p
argument specifies the password. So, for example, mysql -u root -p 123456
will sign into MySQL using the username, root
, and the password, 123456
. By default, MySQL will have an account with a username, root
, and no password. So, the mysql -u root
command will allow you to enter the default installation of MySQL.
Once you have successfully launched the MySQL command line, you will see an interface that is similar to the following screenshot:
When you will start learning the SQL syntax, you will understand how the code works in both MySQL Workbench and the CLI...