Create MySQL User

Create MySQL User

Create a MySQL user in the destination server and give the required grants.

Scenario example:

You want to connect to MySQL server from ServerA ( to MySQL ServerB (

#1 Connect to MySQL ServerB (

mysql -u your-user-name  -p

#2 Create a user using the name you are using for connection which you got the error for and the source IP of ServerA

Replace colored/bold parts with your own data

create user 'name'@'ip.ip.ip.ip' identified by 'password-for-name-user' ;

#3 Grant privileges.

Based on the requirments for your application or user give suitable grants like below example


All -- Grant all privileges
*.* -- All databases and tables

grant all on *.* to 'name'@'ip.ip.ip.ip' identified by 'password-for-name-user' ;

select,update -- Grant only select and update queries.
mike.* -- Only to database named 'mike' and all it's tables.

grant select,update on mike.* to 'name'@'ip.ip.ip.ip' identified by 'password-for-name-user' ;

#4 Reload MySQL Privilegs
To reload the new privileges it's always a good idea to flush it by running below query

flush privileges ;

Subscribe to
for video tutorials updates

One thought on “Create MySQL User

  1. Pingback: MySQL Error: SQLSTATE[28000] [1045] Access denied - dotsway

Comments are closed.