In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "mysql how to increase the database", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "mysql how to increase the database" this article.
In mysql, you can use the "CREATE DATABASE" statement to increase the database, with the syntax "CREATE DATABASE [IF NOT EXISTS] library name [CHARACTER SET character set name] [COLLATE proofreading rule name];".
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
In mysql, you can use the "CREATE DATABASE" statement to create a new database to increase the database.
The syntax format for creating a database is as follows:
CREATE DATABASE [IF NOT EXISTS] [[DEFAULT] CHARACTER SET] [[DEFAULT] COLLATE]
The content in [] is optional. The syntax is as follows:
Database name: the name of the database you created. The datastore of MySQL will represent the MySQL database in a directory manner, so the database name must conform to the operating system's folder naming rules, cannot start with a number, and should be as meaningful as possible. Note that there is no case sensitivity in MySQL.
IF NOT EXISTS: make a decision before creating a database, and the operation can only be performed if the database does not currently exist. This option can be used to avoid errors that are created repeatedly because the database already exists.
[DEFAULT] CHARACTER SET: specifies the character set of the database. The purpose of specifying the character set is to avoid garbled data stored in the database. If you do not specify a character set when you create the database, the default character set of the system is used.
[DEFAULT] COLLATE: specifies the default proofreading rules for the character set.
MySQL's character set (CHARACTER) and proofreading rules (COLLATION) are two different concepts. Character sets are used to define how MySQL stores strings, and proofreading rules define how strings are compared. Later, we will explain the character set and proofreading rules of MySQL separately.
For example, to create a database named mytestdb, execute the CREATE DATABASE statement followed by the database name: mytestdb, and if there is no database: mytestdb in the current MySQL server, the creation is successful, as follows:
CREATE DATABASE IF NOT EXISTS mytestdb
After executing this statement, MySQL returns a message informing you whether the new database has been created successfully.
Show database
The SHOW DATABASES statement displays all databases in the MySQL database server. You can use the SHOW DATABASES statement to view the database you want to create, or you can view all databases on the database server before creating a new database, for example:
+-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | testdb | | mytestdb | +-+ 5 rows in set
There are six databases in this MySQL database server. Information_schema,performance_schema and mysql are the default databases available when we install MySQL, while mytestdb and testdb are the new databases created. Select the database to use before using the specified database, you must tell MySQL which database to use by using the user statement.
USE database_name
You can use the user statement to select the sample database (mytestdb), as follows:
USE mytestdb
From now on, all operations, such as querying data, creating new tables, or calling stored procedures, will have an impact on the current database (that is, mytestdb).
These are all the contents of the article "how to add databases to mysql". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.