Monday, October 21, 2019

Use the USE Command in MySQL to Switch Databases

Use the USE Command in MySQL to Switch Databases Creating a database in MySQL doesnt select it for use. You have to indicate it with the USE command. The USE command is also used when you have more than one database on a MySQL server and need to switch between them. You must choose the correct database each time you start a MySQL session.   The USE Command in MySQL The syntax for the USE command is: mysql  Ã¢â‚¬â€¹ For example, this code  switches to the database named Dresses. mysql  Ã¢â‚¬â€¹Ã¢â‚¬â€¹ After you select a database, it remains the default until you end the session or choose another database with the USE command. Identifying the Current Database If you are unsure which database is currently in use, use the following code: This code returns the name of the database currently in use. If no database is currently in use, it returns NULL. To view a list of available databases, use: About MySQL MySQL is an open-source relational database management system that is most often associated with web-based applications. It is the database software of choice for many of the webs largest sites including Twitter, Facebook, and YouTube. It is also the most popular database management  system for small and medium-sized websites. Almost every commercial web host offers  MySQL services. If you are just using MySQL on a website, you wont need to be involved with the coding- the web host will handle all that- but if you are a developer new to MySQL, youll need to learn SQL to write programs that access MySQL.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.