Actually, users do not have a default database. But we have the default database for the current session. As can be seen from the following query -
mysql> Select Database(); +------------+ | Database() | +------------+ | sample | +------------+ 1 row in set (0.00 sec)
The above result set shows that we are currently using the "sample" database. It is set for the current session. We can set up another database for the current session with the help of USE statement as shown below -
mysql> USE query; Database changed mysql> Select Database(); +------------+ | Database() | +------------+ | query | +------------+ 1 row in set (0.00 sec)
Now, "query" will become the default database for the current session.
The above is the detailed content of What does the user default MySQL database mean?. For more information, please follow other related articles on the PHP Chinese website!