Before you can create some user on MySQL, you have to login into MySQL with root/administrator account.
The root account on MySQL is not belongs to root account on your system, but just on the MySQL. For login to MySQL root account, following this step:
[root@local ~]# mysql -h localhost -u root -p
Now, you can create another account into your MySQL with this command:
mysql> CREATE USER 'someuser'@'localhost' IDENTIFIED BY 'somepassword';
Please don't forget to use "
localhost" when you create the account because if you forgot this, that means the account created could be connect from "%" or all host. We put the "
localhost" for security reason, its mean only "
localhost" can login into the MySQL with "
someuser" username.
After we made the user, then to make the database, we can use
CREATE command:
mysql> CREATE DATABASE somedatabase;
Then, to grant access some user to the database, we use command
GRANT.
mysql> FLUSH PRIVILEGES;
mysql> GRANT ALL PRIVILEGES ON somedatabase.* TO 'someuser'@'localhost' WITH GRANT OPTION;
To check the user have grant access to the database, you can use command
SHOW:
mysql> SHOW GRANTS FOR someuser@localhost;
1 comments:
Certainly like your web-site but you need to check the spelling on several of your posts. A number of them are rife with spelling problems and I find it very troublesome to tell the truth nevertheless I will definitely come back again. You can visit our website Facebook Account Hacker
Post a Comment