Cannot connect to MySQL externally - mysql

I am trying to connect to my MySQL database that I setup on linux externally and it is not working. I have made sure I have the right IP and the root user is able to be used externally. I have tried numerous tutorials but nothing as worked.

You need to create an other user for external connections on a mysql database.
I don't know why but the root user is not working for distant connections. Just create a new user and give it the right to be used externally.

Related

Connecting a Lightsail instance of WordPress to a Lightsail MySQL Database

This is my first go at AWS. I’m trying to install a WordPress site. Here’s what I’ve done so far:
Created a LAMP instance in Lightsail. I’m able to:
SSH into the webroot with Terminal
SFTP into the webroot with Filezilla
Successfully uploaded and expanded the latest version of WP
in the webroot
Using the public IP, accessed the WP setup screen
Created an instance of a MySQL database in Lightsail. I’m able to:
Use Terminal to tunnel into and access it in the browser with
PHPMyAdmin
Successfully create an empty database and user with full
access permissions
Additionally:
Both instances are running in the same region: Virginia, Zone A
(us-east-1a)
I have enabled both Data migration and Public Mode
At the WordPress setup screen I enter the database name, user, password and host. I believe the database host is what the instance calls the endpoint? After all that, I get the following error:
We were able to connect to the database server (which means your username
and password is okay) but not able to select the publicUser database.
I’m quite sure the required credentials are correct, so it must be something with how I’m doing the setup? Any ideas? If anyone has this same setup, can you please post your WordPress config file with the sensitive information removed so I can see how you're connecting?
You've done everything correctly so far. WordPress is now looking for a database with the name publicUser which it cannot find. You either did not create that database (via PHPMyAdmin) yet, or are using the wrong database name.
Once you have either created the database or corrected the configured database name, it should work.

Accidentally deleted MySQL users

I accidentally deleted all users in MySQL including localhost. Now I can't even access my connections. How can I add localhost use to access my connections?
localhost is not a user, it's a special host, referring, well, to the local host. That means the host machine the software in question is running on.
So, when using a MySQL Client software like Navicat, localhost means that you want it to connect to a MySQL database that is running on the same machine as Navicat itself, instead of connecting over the network to a database running on some remote machine.
Now, regarding your question, if you deleted the user table (or its content) from the MySQL database running on your localhost, the only way I know of to bring the users back is restoring a backup of the database, if you have one.
You might be able to get access to the database again by recreating the user table using the mysql_install_db script as pointed out here, but this won't recover the previously existing users.

Rubyonrails mysql database connection problems

I have a domain name and my rails application.
Is there any way to connect with database without giving the IP address of that host name?
I need what changes are needed in my database.yml file.
The error you're seeing is almost certainly because you don't have a root#localhost user in your mysql database. It has nothing to do with the database configuration file.
You need to add the root#localhost user to your mysql database.
It goes without saying that you should not be using your root user in production and it is probably a good idea not to use it in dev either as it's level of privileges may be hiding some problems.
What errors are you seeing?
If you're asking how to connect to a database without using an IP address, that depends on whether or not your database running on the same machine that's hosting your rails app?
If you're database is on the same machine as your rails app, you can just use localhost as your database host name and that should work (assuming your database is running with the default configurations).

joomla mysql cannot see database via workbench

We have a joomla site up and running using a user called 'product_joomla' and a database with the same name.
I am able to connect to the mysql server using the that user above and password.
But I can only see the 'information_schema' database. the user does not seem to have access to the joomla database.
But that does not seem to be the case because the joomla site is using the same user and is working.
I am total noob with respect to mysql and joomla.
I am accessing the mysql database remotely via mysql-workbench.
I cannot figure out why that user cannot see the joomla database via workbench.
Even though we changed the user to accept connections from anywhere (not just localhost) that never updated the actual permissions on the joomla database – users still only granted admin rights if that user logged in from localhost.
So, the website was working via localhost but I was not able to connect remotely.

Connecting to MySQL Database over server

I'm quite a beginner when it comes to working with networks and the like, so apologizes up front. A while back I set up a mySQL database locally on my machine, and have built a number of simple programs that work with it. (aka root:localhost sort of thing).
This has been great, but I'm now hoping to allow other colleagues at my work to access the database from their machines, but I have no idea how.
Likely there will be some network protection issues (firewalls etc), so that may need to be taken into account... (although I have IT's help on this, neither IT or myself really know what is required to 'connect' to the database).
For example, is it just an IP I need? Do I have to change the setup of my database? I understand that localhost would not work from my colleagues computer's, for obvious reasons, I have no idea what would go in its place for others to access it.
I also do not mind having my machine run as the dedicated database machine... I would not be able to run it off a dedicated server or anything like that, beyond my machine.
Any help would be much appreciated!
Thanks.
First of all, what your colleagues need are:
The IP Address where MySQL server is
running.
User and Password to connect remotely
Have the port 3306 open on the network
A MySQL Client (mysql workbench, mysql query browser, toad, heidi or just the Command Line tool).
When you create user in MySQL the have to be something like this:
'root'#'localhost'
That means, the user will work if you connect from localhost with the user root. So you can create user allowed to connect from anywhere:
'juanperez'#'%'
And finally you have be careful about what privileges are you granting to them. Do not forget to comment a line in the options file of the MySQL that says "bind-address" (this options prevents remote connection).
For example, is it just an IP I need?
Yes. You'll be much happier if you set up proper domain names, but a domain name is just an alias for the IP address.
Do I have to change the setup of my database?
No, but... You have to add some user credentials to support remote logins. That's a change, but not a change to a schema. It's changes to the permissions.
I understand that localhost would not work from my colleagues computer's, for obvious reasons, I have no idea what would go in its place for others to access it.
What MySQL Admin tools are you using? Often there is good help there.
You must read reference manual 4.1 or 5.0
For whatever version is appropriate.
It's very clear.
A user is identified by a username#hostname. You can specify IP addresses (or even "%" for the hostname.
You will use following commandline to connect -
mysql -u<user-id> -p<password> -h<your-hostname-or-ipaddress>
For applications running on different machines trying to connect to your database, you only need to replace 'localhost' with your machine's hostname or ipaddress.
In, general if you are able to ping your machine from a different system, your database can be connected to from that machine, just use whatever name you used for 'pinging' in place of localhost.
Use your workstation IP address or workstation name. You will need to enable remote access. Go to this link for how:
http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html