MySQL database installation defaults to local access only, if you need remote connection to do something according to different operating system
Windows:
The newly installed MySQL cannot log on locally and is displayed as a 1045 error
mysql#1045 (1045Access denied for user ' root ' @ ' localhost ' (using Password:yes)
Workaround: Modify the MySQL database configuration file My.ini and add a line below [mysqld] Skip-grant-tables
The MySQL database can be successfully accessed locally, but cannot be accessed remotely
Modify user rights on this machine, default is localhost for%
In the MySQL database user table, change localhost directly to "%",
UPDATE USER SET host= '% ' WHERE user= ' admin ';
Or add a row host to "%", set password to access database password consistent
UPDATE USER SET password=password (' baihong159753 ') WHERE host= '% ' and
user= ' admin ';
If remote access is still not available, you must modify the MySQL database configuration file My.ini
Add a line under [mysqld] This skip-name-resolve means: ignore the way the host name is accessed
Lower_case_table_names=1, which means: ignore the case in the database, this line can be added without
Ubuntu:
Step 1:
Vim/etc/mysql/my.cnf Found bind-address = 127.0.0.1
Comment out this line, such as: #bind-address = 127.0.0.1
or instead: Bind-address = 0.0.0.0 Allow any IP access, or specify an IP address yourself.
Restart Mysql:sudo/etc/init.d/mysql restart
Step 2:
The user's host in the MySQL database user table is changed to%
Centos:
Mysql>use MySQL;
Mysql>update user set host= '% ' where host= ' localhost ';
Mysql>flush privileges; # Overloaded System permissions
Allow Port 3306
- Iptables-i input-p tcp-m State--state new-m TCP--dport 3306-j ACCEPT
- /etc/init.d/iptables Save
- Iptables-l-N # or: Service iptables status
About MySQL Database remote access