The below commands are useful for connecting to the MySQL.
1. How to check the MySQL Status.
# service mysqld status
2. Connecting to the MySQL.
# mysql -u root -p
Here we have to provide the password whenever it prompts for it. After that we will be connecting to the server.
3. How to START / STOP a Service.
# service mysqld start
# service mysqld stop
# service mysqld restart
4. To see the list of databases.
# show databases;
5. How to switch from one database to another database.
# USE <dbname>;
# USE <Manish>;
6. To see the list of tables.
# Show Tables;
7. To Delete a table.
# Drop table <tablename>;
# Drop table manish_a;
8. To Drop a Database.
# Drop Database <dbname>
# Drop Database Manish;
9. To see the MySQL Version;
# SELECT VERSION();
10. To see the current Date.
# SELECT CURRENT_DATE();
11. To see the date and Time;
# SELECT NOW();
12. To see the user.
# SELECT USER();
No comments:
Post a Comment