Reputation: 442
I launched an EC2 instance on AWS and am using Ubuntu. I am able to connect to MySQL on the instance itself. (i.e. mysql -h localhost -u root -p)
but when I try and connect from my remote computer (i.e. mysql -h ipaddress -u remoteUN -p)
ERROR 2003 (HY000): Can't connect to MySQL server on 'ipaddress' (61)
I have changed my security settings to allow all IP addresses to connect to port 3306, as well as port 22, and on the instance I created a user that can access MySQL from a remote server
> CREATE USER 'tempuser'@'%' IDENTIFIED BY 'password';
> GRANT ALL PRIVILEGES ON *.* TO 'tempuser'@'%'
> WITH GRANT OPTION;
I tried to start/stop the mysql server using
> service mysqld restart
and get the following
==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units ===
Authentication is required to restart 'mysqld.service'.
Authenticating as: Ubuntu (ubuntu) Password:
I'm not sure what the default password is, and when I enter my MySQL password I get
polkit-agent-helper-1: pam_authenticate failed: Authentication failure
==== AUTHENTICATION FAILED ===
Failed to restart mysqld.service: Access denied
See system logs and 'systemctl status mysqld.service' for details.
> systemctl status mysqld.service
mysqld.service
Loaded: not-found (Reason: No such file or directory)
Active: inactive (dead)
Anyone know what default password is or how to restart the server so that I can connect remotely?
Upvotes: 0
Views: 881
Reputation: 6079
What is disabled by default is remote root
access. If you want to enable that, run this SQL command locally:
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Now as of not being able to connect remotely you will have to comment out bind ip
line in my.cnf
file which usually lives on /etc/mysql/my.cnf
on Unix/OSX systems. In some cases the location for the file is /etc/mysql/mysql.conf.d/mysqld.cnf
).
Find the Line :
bind-address = 127.0.0.1
and comment it out by adding #
in front of it save and restart mysql , you should be able to connect to it remotely.
Hope this helps !
Upvotes: 1