In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
MySQL to create a database using mysqladmin to create a database
With normal users, you may need specific permissions to create or delete MySQL databases.
So we use the root user to log in, and the root user has the highest privileges, so we can use the mysql mysqladmin command to create the database.
Example
The following command simply demonstrates the process of creating a database, named RUNOOB:
[root@host] # mysqladmin-u root-p create RUNOOBEnter password:*
The MySQL database RUNOOB is created after the above command is executed successfully.
Create a database using a PHP script
PHP uses the mysqli_query function to create or delete an MySQL database.
This function takes two arguments and returns TRUE on successful execution, or FALSE otherwise.
Syntax mysqli_query (connection,query,resultmode); parameter description connection is required. Specifies the MySQL connection to be used. Query is required, specifying the query string. Resultmode
Optional. A constant. It can be any of the following values:
MYSQLI_USE_RESULT (use this if you need to retrieve a large amount of data)
MYSQLI_STORE_RESULT (default)
Example
The following example demonstrates using PHP to create a database:
Create a database
When the execution is successful, the following result is returned:
If the database already exists, the following result is returned after execution:
MySQL connection
MySQL deletes the database
Note list
Windhut
Abc***@163.com
After logging in using root, you can use the
CREATE DATABASE IF NOT EXISTS RUNOOB DEFAULT CHARSET utf8 COLLATE utf8_general_ci
To create a database, what this command does:
1. If the database does not exist, it is created, and if it does, it is not created.
two。 Create a RUNOOB database and set the code set to utf8
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.