Installation of MySQL

Official website of MySQL is https://www.mysql.com/

MySQL is offered in various editions as mentioned below.

  1. Enterprise Edition
  2. Standard Edition
  3. Classic Edition
  4. Embedded Edition
  5. Community Edition

For learning purpose, you should download the community edition.

You can visit https://dev.mysql.com/downloads/file/?id=465371 and download the web installer.

Note that you will have to install python before you start installation process of MySQL.

When installation is completed, MySQL server starts running at port 3306
Default user id is root and password is blank.

MySQL.exe is located in below directory. So you can add this path in PATH environment variable, so that you can use mysql command from the command prompt.

C:\Program Files\MySQL\MySQL Server 5.7\bin

To connect to MySQL from command line, you have to use below command.
mysql -u root -p

Then you have to press enter key. If you have set the password for root, you will be asked to enter the password. If everything goes well, you will be connected to the mysql.

If you want to use the password in same command, you need to type it right after -p switch without space as shown in below command.

mysql -u root -pmypass

If you use incorrect password, you may get below error.
ERROR 1045 (28000): Access denied for user ‘ODBC’@’localhost’ (using password: NO)

You also get below error if you execute below command.
mysql -u root
Note that -p switch is very important.

Also do not try to enter the password in the same, otherwise you will get below error.

mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user ‘root’@’localhost’ (using password: YES)

After the connection is successful, MySQL version is displayed and then you can execute any MySQL command in the interpreter.

To exit MySQL, you have to use exit command.

You may also like...