Tag » Posts Tagged ‘User Account’

Setting user account passwords in MySQL


It is important to have passwords for all MySQL user accounts for securing the database. If anyone knows the username of an account with no password then he can successfully connect to the database server.

To assign or change a password for an existing account

mysql> SET PASSWORD FOR 'newuser'@'localhost' = PASSWORD('mypass');

NOTE: Only users such as root that have update access to the mysql database can change the password for other users.

Continue reading »

Deleting user accounts in MySQL


The DROP USER statement is used to delete MySQL accounts and their privileges.

DROP USER 'accountuser'@'localhost';

If you wish to delete multiple user accounts then you can enter them comma separated as shown below:

DROP USER 'accountuser1'@'localhost', DROP USER 'accountuser2'@'localhost';

Continue reading »

Creating user accounts in MySQL


MySQL user names can be up to 16 characters long.

Here are the queries for creating user accounts in MySQL:

Create user with no password

mysql> CREATE USER 'newuser'@'localhost';

Create user with password test123

mysql> CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'test123';

Continue reading »

Back to top