Home  >  Article  >  Database  >  Use MySQL database (3) Select the database you want to operate

Use MySQL database (3) Select the database you want to operate

黄舟
黄舟Original
2016-12-27 17:19:211773browse

Select the database to be operated

To operate a database, you must first select the database, otherwise an error will be prompted:

ERROR 1046(3D000): No database selected

Two ways to use the database:

One: Specify when logging in to the database, command: mysql -D selected database name -h host name -u user name -p

For example, when logging in, select the database you just created: mysql -D samp_db -u root -p

2: Use the use statement to specify after logging in, command: use database name;

use The statement can be made without semicolon. Execute use samp_db to select the database just created. After the selection is successful, it will prompt: Database changed

The above is the content of using MySQL database (3) to select the database to be operated. More related Please pay attention to the PHP Chinese website (www.php.cn) for content!


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn