How am I able to connect to a database even when mysql server is not running?
Earlier I was getting error 2003 regarding can't connect to localhost
when i used mysql -h localhost -u root -p'mypassword'
I searched and found relevant answers at Stack OverFlow and I ensured that MySQL service was running, but still the problem persisted.
But then I omitted -h localhost
from this command and used instead: mysql -u user -p mysql
and entered my password as prompted. Then I was connected to mysql.
In other words I can connect with any database in MySQL server even when it's not running using above commands,But still:
How does all of this is working?
Type in
netstat -tlnp
If you see
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 1711/mysqld
that means mysql is listening on all interfaces and then loopback should work also, like in my case (i used -h localhost).
I'm supposing you have disabled logon on loopback and have like 192.168.1.100:3306 for example.
Regards, Mirko
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.