![]() ![]() If you want to grant access from another host(s) just change the localhost with the remote machine IP or use '%' wildcard for the host part, which means that the user account will be able to connect from any host. In the command above we have set the hostname part to localhost which means that this user will be able to connect to the MySQL server only from the localhost ( i.e from the system where MySQL Server runs). Run the following command, just replace ‘database_user’ with the name of the user that you want to create: CREATE USER IDENTIFIED BY 'user_password' To avoid this error you can use the following command: DROP DATABASE IF EXISTS database_name Create a new MySQL user account #Ī user account in MySQL consists of a user name and host name parts. If you try to delete a database that doesn’t exist you will see the following error message: ERROR 1008 (HY000): Can't drop database 'database_name' database doesn't exist To delete a MySQL or MariaDB, database run the following command: DROP DATABASE database_name Query OK, 0 rows affected (0.00 sec) Make sure that you are not removing a wrong database, as once you delete the database it cannot be recovered. This is a non-reversible action and should be executed with caution. Is as simple as running a single command. These databases are necessary for the proper functionality of the MySQL installation. ![]() The information_schema, mysql, performance_schema, and sys databases are created at installation time and they are storing information about all other databases, system configuration, users, permission and other important data. The output will look something like this: +-+ That exist on our MySQL or MariaDB server with the following command: SHOW DATABASES In the output above, Query OK means that the query was successful, and 1 warning tells us that the database already exists and no new database was created. To avoid errors if the database with the same name as you are trying to create exists you can use the following command:Ĭreate MySQL Database Using Command Prompt XAMPP | 2020 CREATE DATABASE IF NOT EXISTS database_name Query OK, 1 row affected, 1 warning (0.00 sec) ![]() If you try to create a database that already exists you will see the following error message: ERROR 1007 (HY000): Can't create database 'database_name' database exists Run the following command, just replace database_name with the name of the database that you want to create: CREATE DATABASE database_name Query OK, 1 row affected (0.00 sec) To open the MySQL prompt, type the following command and enter the MySQL root user password when prompted: mysql -u root -p Create a new MySQL database # All commands will be executed as a root user. ![]() Before you begin #īefore you start with this tutorial, we are assuming that you already have MySQL or MariaDB server installed on your system. This tutorial explains how to use the command line to create and manage MySQL or MariaDB databases and users. MySQL server allows us to create numerous users and databases and grant appropriate privileges so that the users can access and manage databases. MySQL is the most popular open-source relational database management system. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |