Connecting to a MySQL database from the command prompt can be very easy:
[roo[email protected]]#mysql -S /opt/db/mysql//mysql.sock -uroot -prootPassword
Here, we are trying to connect to the MySQL database
- Installed in location /opt/db/
- Database Name is the database name
- -u indicates the parameter username, i.e. in this case it is root
- -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.