You are on page 1of 10

Database Command

Create New user in MySQL



Create / Add new user in mysql

CREATE USER 'user'@'localhost' IDENTIFIED BY
'Password#12';
Add File in Database

Add sql file in database

mysql -u username -p database_name < file.sql
User Login in MySQL

User login in MySQL

mysql -u root -p

i.e mysql -u dev -p

All MySQL User and Password

Root User

mysql -u root -p

Personalhp11##

Dev User

mysql -u dev -p

Nopass#123

User User

mysql -u user -p

LoraLora#123
Show All MySQL Users

Show mysql users

Select user from mysql.user;

Show mySQL Users Details

select * from mysql.user;
Show Current User

Show Current User

Select user();

or,

Select current_user();

Show Current Logged User

Show Current Logged User

SELECT user, host, db, command FROM
information_schema.processlist;
Give all Permission to User

Gerant all Permission / Privileges to user

GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost';
change password in mysql

Change User Password in MySQL

ALTER USER 'user-name'@'localhost' IDENTIFIED BY
'NEW_USER_PASSWORD';

FLUSH PRIVILEGES;


i.e ALTER USER 'user'@'localhost' IDENTIFIED BY
'LoraLora#123';

You might also like