These cookies ensure basic functionalities and security features of the website, anonymously. Necessary cookies are absolutely essential for the website to function properly. How to create a User and grant privileges on MySQL and MariaDB. (German only) Use the command ‘SHOW DATABASES ’ to double check the database was deleted. If everything went correctly it will show you a simple “OK”. The mysql-console is not very helpful here. ‘DROP DATABASE ’, where is the name of the database you want to delete.Īn example could look like this: mysql> DROP DATABASE blog Query OK, 0 rows affected (0.01 sec) mysql> The syntax is similar to creating a database. To do delete a database you need the command ‘DROP DATABASE’. Now copy the name of the database you want to delete. Use the command ‘SHOW DATABASES ’ in the mysql-console like in the example above. Once the database is deleted, there is normally no going back.įirst list all databases on your server. If you delete a database directly with the command line tool, be sure to delete the correct one. Mysql> Deleting a MySQL or MariaDB database with DROP Database If you now list all your databases again, you can find the newly created database in the output: mysql> SHOW DATABASES If everything went well, you just created a database called blog. mysql> CREATE DATABASE blog Query OK, 1 row affected (0.00 sec) mysql> Just use the SQL command ‘CREATE DATABASE ’ to create a Database with the name. Create a MySQL or MariaDB databaseĬreating a new database under MySQL or MariaDB is just as easy as listing the existing databases. mysql> SHOW DATABASES +- +| Database |+ -+ | information_schema | | mysql | | performance_schema | +-+ 3 rows in set (0.00 sec) mysql>Īs you see, my server is boring and empty. Make sure you have the command in your SQL console with the semicolon at the end. First of all, let MySQL or MariaDB show you all existing databases with the command ‘SHOW DATABASES ’. If you have a freshly installed system with a new MySQL or MariaDB instance, then probably not all too many databases exist. mysql>ĭirectly after logging in as an administrative user (root), you can create new databases or display existing databases. Type '\c' to clear the current input statement. Other names may be trademarks of their respective owners. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Your MySQL connection id is 98 Server version: 5.5.47-0+deb8u1 (Debian) Copyright (c) 2000, 2015, Oracle and/or its affiliates. If everything goes well, then you should see the following output: mysql -u root -p Enter password: Welcome to the MySQL monitor. If you have not set a password for the user root, do not use the parameter ‘-p’. If your MySQL or MariaDB server has set a password, then you call the program as follows: Copy mysql -u root -p Once you are logged in to your server, you simply use mysql-binary to login. If you have not yet created a new user who has the rights to create new databases, use the user ‘root’. If you are logged on to the server, you can simply log on to your MySQL or MariaDB server. On Windows, you can use the program PuTTY, on Linux, use any terminal program (like xTerm), and on MAC OS X you simply use the built-in terminal (type “terminal” in the Spotlight search and confirm with Enter). To do this, connect to your server via SSH. Starting MySQL Consoleįirst, log on to your MySQL or MariaDB server. Then we will show you how to delete the new (or any other) database. In this article, we will guide you through the commands of MySQL or MariaDB to create a new database. We work with these databases very often and have found that most tasks can be done with a handful of commands. MySQL and MariaDB belong to the relational databases. Relational databases (MySQL, PostgreSQL, Oracle and similar), and so-called non-relational databases, also called no-SQL databases. There are actually only two large areas of databases. So it is no surprise that most of the common software support them natively. Create and delete a MySQL database What’s the matter?įor years MySQL and MariaDB have been the most popular OpenSource Database Managment Systems world wide.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |