Select a Category

Common MySQL Operations

Here are some common MySQL Operations

Log into MySQL with following command:  mysql -u root -p

Create a new database name sample:  create database sample;

Create a sample user in local host with password ‘secret’: create user sample@localhost identified by ‘secret’;

Grant all Privileges to sample user on database sample: grant All Privileges on sample.* to sample@localhost identified by ‘secret’;

Delete user ‘sample’: drop user sample@localhost;

Rename user ‘sample’ to ‘guest’: rename user sample@localhost TO guest@localhost;

Comments are closed.