Most MySQL users manage their databases using some type of graphical user interface (GUI), whether it is a web-based tool like phpMyAdmin or a desktop tool like MySQL Administrator. For a dedicated server system administrator, however, there are times when it may actually be more convenient to use queries in the MySQL text-only command line interface.
You can easily add and drop users from MySQL, each with a single command string. Assuming you are already logged into your server via the physical console or SSH, the first thing you need to do is login to the MySQL command interface.
# mysql -p
You will then be prompted for your MySQL password. Type it and press Enter. If the login is successful, your normal shell prompt will be replaced by the MySQL prompt:
To add a user, type the following string at the prompt:
mysql> CREATE USER user@host IDENTIFIED BY 'password';
Replace “user” with the username you want to create and “host” with your server IP or “localhost” for the current machine.
To remove a user, type the following:
mysql> DROP USER user@host;
- How to Remove MySQL Databases and Users
- How to Manage MySQL Users in cPanel
- How to Manage MySQL Users in Webmin
- MySQL User and Password Management
- How to Find Things in a MySQL Database