In fact, usually, all you get is a Query OK message. Confirm that the database has been successfully removed. There’s no “Are you sure?” prompt, and unless you have a backup, you won’t be able to restore the database after you hit enter, so make sure you double-check everything.ĥ. Locate the database you want to delete and make sure you memorize its name.Ī single command deletes the database. MySQL will display a list of your user account’s databases. To see all databases, use the following command: That’s why it might not be a bad idea to go through the list of existing databases on the account and ensure you get the name right. Without it, MySQL interprets the Enter key as a new line.ĭeleting a database via the command line is irreversible, so before you go on, you want to make sure you erase the correct one. What you do need to remember, however, is that all SQL commands end with a semicolon. The commands will work even if you don’t stick to it. Mind you, this is more of a guidance than a rule. However, there are a few things that may catch newbies out.įirst, it’s accepted that SQL statements must be written in uppercase letters for readability purposes. Generally speaking, the syntax, especially for simple tasks like deleting a database, isn’t that complicated. Identify the database you want to delete.įrom now on, we’ll use SQL commands. Whatever the case, you’ll need the following command to log in to the MySQL server:Īfter providing the user account’s password, you’ll see the mysql> prompt.ģ. Other accounts may have access to specific databases only. If you have an account with SYSTEM_USER privileges (like the root account, for example), you can delete any database you want. You need to use a user account with sufficient privileges to delete a database. SPanel will automatically redirect you to the command-line interface and open a shell. You can log in to the User Interface and open the SSH Terminal. If you use SPanel, you have a third option. Although native SSH support is now available on all operating systems, some people continue to prefer dedicated clients because of the additional features and the ability to easily access saved sessions. If the server uses a custom SSH port (the default one is port 22), you need to add -p followed by the port number.Īfter successful authentication, the server will start the session.Ī second option would be an SSH client application like PuTTY. The command for starting an SSH session looks like this: If you use Windows, you can choose between Command Prompt or PowerShell, and if you’re on a Unix-based OS, you have the default Terminal as well as a number of third-party applications with the same functionality. You can use your operating system’s command-line tool. There are several options for establishing an SSH connection. Those of you with less experience may be a bit intimidated by the prospect of using commands, but the truth is, if you approach the task meticulously, you’ll see that there’s little to go wrong.ĭeleting a MySQL database involves several steps, which we’ll now go into.ġ. The traditional way to delete MySQL databases is via the command line. Deleting a MySQL Database Through the Command-Line Interface Most likely, your project uses it as well, and you may have not one but multiple MySQL databases on your hosting account.īut what do you need to do if you want to get rid of one of them? The relational database management system powers most web applications and is integral to almost all modern websites.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |