mysql

I am not good with database but I use these basic commands to fill my word. We could use either commands line utility or other third party

software like sqlyog or pgadmin III, but I prefer commands like because it is fast, more options and can view the processing of the commands.

Here are the basic commands to create user, database and grant privileges to users

To Connect into sql
#sudo mysql -p
password: *******

Type a password and enter into sql
mysql>

To create a user
#create user ‘Username’@’%’ identified by ‘password’;

To create database
#create database DatabaseName;

To grant priviligies to a user
#grant all privileges on DatabaseName.* to ‘UserName’@’%’;

To flush privileges
#flush privileges;

To view grants for a user
#show grants for ‘UserName’@’%’;

To display databases
#show databases;

To drop a user
#drop user ‘UserName’@’%’;

To revote privilege for a user

#revoke all privileges, grant option from ‘UserName’@’%’;

To drop a database

#drop database DatabaseName;

Advertisements