MySQL user creating and allow connecting from custom IP

From Kolmisoft Wiki
Revision as of 16:13, 25 November 2011 by Admin (talk | contribs)
Jump to navigationJump to search



About

MySQL user creating and allow connecting from custom IP.

Login

At first login to mysql database as root
type this into terminal:

mysql -u root -p 

When issue such commands:


To create user

                               enter ip
CREATE USER 'enterusername'@'xxx.xxx.xxx.xxx' IDENTIFIED BY 'enterpassword';

To set all privileges


To set Privileges

                                                     enter ip
GRANT ALL PRIVILEGES ON mor.* TO 'enterusername'@'xxx.xxx.xxx.xxx' WITH GRANT OPTION ;

Now you can connect from your entered ip to mysql.
If you still can not connect check or port 3306 is open

nmap -sS -O 127.0.0.1

if port 3306 is not open. You need open port:


Open MySQL port

iptables -I INPUT -p tcp --dport 3306 -j ACCEPT

Save iptables configuration:

service iptables save