For a remote computer, created a user of type 'user' @ 'mypc', how can I now connect to it on the server?
From a remote PC I connect as follows:
mysql -h serverSQL -u user -p How to connect on behalf of this user on the server?
You will not be able to connect locally from under the remote user account 'user' @ 'mypc', unless you have specified any host 'user' @ '%' instead of mypc. If mypc is the address of the remote server, the MySQL server will wait for requests from it.
To log in locally as a user, you need a local user account 'user' @ 'localhost' or 'user'@'127.0.0.1', then you can log in
mysql -u user -p or simply at the command of mysql , if you write in the [client] section in .my.cnf the user name and password
[client] user=user password=pass If you are directly on the server either via ssh or via telnet or another option. You will only need to perform:
mysql -u user -p Then enter the user password.
The main thing is that the user user on the mysql server is allowed access not only from the remote host aka your computer but also access from localhost or even from any host, as well as that the MySql server is configured to listen on both the external interface and localhost.
If you want to connect on behalf of the current user, under which you work in the system, then just do not specify the -u parameter
mysql -h host.sql.ru -p12345 When trying to connect, the current system user name will be automatically substituted.
Source: https://ru.stackoverflow.com/questions/562241/
All Articles