Submitted by: M S Sridhar(sridhar.ms@gmail.com)

Monday Mar 26th 2018 by M S Sridhar

Language: SQL, Expertise: Intermediate - Learn an easy way to connect to a MySQL database from the command prompt.

Connecting to a MySQL database from the command prompt can be very easy:

[root@mypc]#mysql -S /opt/db/mysql//mysql.sock -uroot -prootPassword

Here, we are trying to connect to the MySQL database

  1. Installed in location /opt/db/
  2. Database Name is the database name
  3. -u indicates the parameter username, i.e. in this case it is root
  4. -p indicates the parameter password, in this case it is rootPassword

Most importantly, we are connecting using sockets, which is faster than any other type of connection.

Mobile Site | Full Site
Copyright 2018 © QuinStreet Inc. All Rights Reserved