简体   繁体   中英

Can't connect to mysql database from my ubuntu server

I'm such a noob with databases, so, I have my ubuntu server up and running, I have mySQL installed and I'm trying to create a simple database that will act as calendar, (when I will access to it through my android app, it will have to show me if at a specific day and hour, if I'm busy or not). I have this my.cnf file:

!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/

[msqld]
bind-address = 192.168.1.8
port = 3306

When I try connecting to it using:

 mysql -h 192.168.1.8 -u root

from the terminal of my server it shows up this error:

ERROR 2003 (HY000): Can't connect to MySQL server on '192.168.1.8' (111)

I tried commenting bind-address line, and port line too. I tried binding 0.0.0.0, I tried adding user line and password line, nothing changed. What am I doing wrong? and what should I add to my.cnf file?

Are you trying to connect from remote computer ?

  • If yes (remote access), is 192.168.1.8 the good ip or try to remove the bind-address line
  • If no (local access only), replace the IP by 127.0.0.1

And restard mysql daemon.

sudo service mysql restart

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM