- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can we establish MySQL database by using MySQL binary at command prompt?
You can establish the MySQL database using the mysql binary at the command prompt. It can be understood with the help of the following example −
We can use following statements to connect to the MySQL server from the command prompt −
[root@host]# mysql -u root -p Enter password:******
This will give us the mysql> command prompt where we will be able to execute any SQL command. Following is the result of above command −
The following code block shows the result of above code −
Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 4 Server version: 5.7.20 MySQL Community Server (GPL) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
In the above example, we have used root as a user but you can use any other user as well. Any user will be able to perform all the SQL operations, which are allowed to that user.
We can disconnect from the MySQL database any time using the exit command at mysql> prompt.
mysql> exit Bye
- After connecting to MySQL server how can we select a database from command prompt?
- Print structured MySQL SELECT at command prompt
- How can we delete a MySQL database by using PHP script?
- How can we select a MySQL database by using PHP script?
- Getting MySQL path in command prompt
- How do we print a variable at the MongoDB command prompt?
- What is MySQL CREATE command? How can we create both database and table with this command?
- Write an example to establish MySQL database connection using PHP script?
- How can we analyze the tables of a particular database from MySQL Server command line?
- How can we create our own choice MySQL database?
- How can we return to windows command shell from MySQL command line tool?
- Which PHP function is used to establish MySQL database connection using PHP script?
- How can we create a new database by using mysqladmin?
- How can we drop an existing database by using mysqladmin?