How To Create Mysql Database

Table of contents:

How To Create Mysql Database
How To Create Mysql Database

Video: How To Create Mysql Database

Video: How To Create Mysql Database
Video: How to Create a MySQL Database for Beginners in MySQL Workbench 2024, November
Anonim

MySQL DBMS is one of the most popular in the world. It is used in both small and huge high-load projects. Therefore, experience with mysql will not be superfluous for any IT technician. You can learn how to work with mysql by reading the documentation and practicing. But this will raise many questions. And one of the first will be the question of how to create a mysql database and by what means it is best to do it.

How to create mysql database
How to create mysql database

Necessary

Data for accessing the mysql server. Mysql console client

Instructions

Step 1

Connect to mysql database server. To do this, start the mysql console client with the correct values for the -h, -u, and --password parameters. The -h parameter specifies the hostname of the mysql server. The -u parameter specifies the username under which the mysql client should log into the server, and the --password parameter specifies the user's password. The server hostname can be an IP address or a symbolic name. The mysql client startup line for connecting to a database server running on the local machine with username test_user and password test_user_pwd might look like this: "mysql -h localhost -u test_user --password = test_user_pwd". If the client program has successfully connected to the server, a corresponding prompt will appear on the screen.

Step 2

List the available character sets that can be used to create databases. Enter the command "SHOW CHARACTER SET;" and press the ENTER key.

Step 3

List existing databases. Enter the command "SHOW DATABASES;" and press the ENTER key.

Step 4

Select a name and character set for the database to be created. The name must not appear in the list of existing database names. The character set must be installed on the server. It can be selected from the list displayed by the "SHOW CHARACTER SET;" command.

Step 5

Create a mysql database. To do this, enter a command of the form "CREATE DATABASE` database_name` CHARACTER SET character_set COLLATE comparison_rules; ". Specify the database name of your choice for the "dbname" parameter. The "charset" parameter must be a valid character set name. For the "collation_rules" parameter, specify the value of the "Default collation" field from the list of character sets corresponding to the selected set. If you are not sure which character set to use for your database, choose utf8. This is a universal set that supports almost all existing symbols of almost all languages of the world. Upon successful creation of the database, a corresponding message will be displayed.

Recommended: