This article is a collection of three on how to open the mysql tutorial remote connection, the first paragraph is to mysql cmd command prompt to open the remote connection to mysql, the third method is to modify the mysql my.ini file configuration to modify the oh.
method one
Like to open mysql remote connection function?
First link the machine's mysql (use ssh login terminal, enter the following command):
mysql -uroot-p
Enter the password to log in, enter the following statement, execute.
grant all privileges on *. * to 'user' @ '%' identified by 'password' with grant option;
Among them, the user is the user name, mysql acquiescence is the root password is the password to set their own. % Means any host. This allows any remote host to access it.
Method Two
Open mysql remote function as follows:
Into mysql, create a new user itbc:
Format: grant permissions on the database tutorial name. Table users @ login host identified by "user password";
grant select, update, insert, delete on *. * to itbc@192.168.88.234 identified by "itbc1234";
View the results, execute:
use mysql;
select host, user, password from user;
You can see in the user table has just created itbc users. host field indicates the host login, the value can be ip, host name can be used, the host field value changed to% on any client machine to itbc user to log in to the mysql server, it is recommended that the development of% .
update user set host = '%' where user = 'itbc';
Method three
mysql acquiescence can not be accessed through the remote machine, through the following configuration can open the remote access.
My mysql environment is ubuntu + mysql5
1. Modify /etc/mysql/my.conf, modify the bind-address, designated as the actual ip address of this machine, your my.con revised finished probably look like the following
[mysqld]
#
# * basic settings
#
default-character-set = utf8
default-storage-engine = innodb
bind-address = 192.168.1.107
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = / usr
datadir = / var / lib / mysql
tmpdir = / tmp
language = / usr / share / mysql / english
skip-external-locking
2 root login mysql execute the following command
grant all on sonardb. * to sonar @ '%' identified by '123456';
grant all on sonardb. * to sonar @ localhost identified by '123456';
sonardb replace the database name you want to visit, sonar is the user name you want to use, 123456 replaced with your password, thus opening the remote access function.