I am new in XAMPP MySQL and PHPMyAdmin. The databases on these two platforms should be the same. However, similar to the problems shown in MySQL and PHPMyAdmin matching problem,
I found that SELECT ##hostname have the same results on XAMPP MySQL and PHPMyAdmin. However, the result for running SHOW databases on XAMPP MySQL is
*
information_schema |
mysql |
people |
performance_schema |
phpmyadmin |
test
*
whereas the result for running SHOW databases on PHPMyAdmin is
*
information_schema |
test
*
By the way, I am running XAMPP MySQL on Windows 10 PowerShell. Comments and ideas are appreciated.
Probably when you're connecting through phpMyAdmin, you're authenticating to MySQL as the anonymous user. Most MySQL installations come with an anonymous user which doesn't have many privileges at all, but can connect and see the databases you reference.
This could be because you're using a different username and password, or because the two methods are using a different connection type — to MySQL, a connection to over TCP/IP networking authenticates as a user with host "%" (or a specific IP address). A socket connection authenticates to the "localhost" host. Using host names of 127.0.0.1 (or any IP address/hostname) forces a TCP/IP connection; connecting to 'localhost' forces a socket connection.
So probably what's happening here is that you're using the phpMyAdmin default connection type of localhost and telling the command-line client to connect to 127.0.0.1, but you only have your user set for host '127.0.0.1' (or '%'). You can edit your phpMyAdmin configuration to tell it to connect to 127.0.0.1 instead, or duplicate the user#127.0.0.1 and give the new user the host 'localhost'. Either should get you in again if this is the cause.
Related
When I was connecting to the database I always used "localhost" as a host name.
Now I want to connect to my MYSQL database from Windows program and I have to use the real IP instead of localhost.
I tried to use the server IP and IP from this:
SHOW VARIABLES WHERE Variable_name = 'hostname'
But both don't work. How can I check the real IP adress, which can be used to connect to MYSQL DB?
MYSQL database was installed on my Debian server without any special settings I think.
Check the user table in MySQL.
select user, host from mysql.user;
Check either they have privileges to connect remotely or not.
Also check bind-address in configuration file, it has to be commented.
I have created a free application using openshift, and created MySQL and phpmyadmin cartridges and inside my phpmyadmin I have gave access to all users from anywhere with all privileges now the problem is when I try to connect from my local MySQL workbench i get connected but I don't see my tables I have created in remote server using phpmyadmin and I can't do any action at all like creating schemas or tables where i get
ERROR 1044: Access denied for user ''#'localhost'
Remember that I allowed all privileges for any user, but I still get access denied for any action except only for the database connection.
Make sure the user you've given full permissions to is the same user MySQL Workbench is connecting as -- there's a difference between the hosts % and localhost for instance. From MySQL Workbench, issue the "Status" command and compare the username and host against what you've configured.
You're apparently connecting through 'localhost' so you have to give full permissions to the anonymous user with host localhost (or change your connection type to tcp so that your connection is via 127.0.0.1 instead of localhost).
Edit for further clarification: The MySQL permission structure treats different types of connections differently; a client connecting via TCP connection always appears to come from an IP address, even if it's from the "local host" (in the sense of being on the same machine), in which case that IP address of the incoming connection may be 127.0.0.1. Socket type connections are registered in MySQL as coming from the host "localhost" (literally, in this case). This is why we're verifying which host MySQL Workbench is connecting as.
Different connection types appear differently to MYSQL even if they're coming from the same "local machine." Furthermore, the wildcard host does not include 'localhost' socket connections, those are a separate entry in the permissions field with the 'localhost' host name; the wildcard does not apply, as I explained above. This is the reason why we're checking which permissions you set against what MySQL Workbench is connecting as; it's the most common cause of difficulties such as these.
I have a mysql database on an unmanaged rackspace cloud server. I can connect to phpmyadmin with no issues. I checked if port 3306 is listening and it is. /etc/mysql/my.conf shows bind-address = 127.0.0.1.
When I use navicat to connect via ssh, it says SSH tunnel: Invalid username or password! I've reset my passwords and restarted mysql and the server just to make sure but I still can't connect. What can I try next to get this working?
Please connect to MySQL and run
SELECT USER(),CURRENT_USER();
What does this output ???
USER() reports how you attempted to authenticate in MySQL
CURRENT_USER() reports how you were allowed to authenticate in MySQL
If the output of these two functions do not match, you will need to create a user that matches the USER() or CURRENT_USER().
If they are both root#localhost, please run
SELECT user,host,password FROM mysql.user;
Now, visible compare if all root users have the same password.
Also, please check the contents of /etc/hosts on the server.
This not fully an answer, but I hope this helps !!!
I am running MySQL on an Amazon AWS Instance. I was able to previously connect to the MySQL Database via MySQL Query Browser. Now I am traveling outside the U.S. and I am having trouble connecting via the Query Browser. I am able to use Terminal to create an ssh connection and then login to MySQL, so it does not appear to be a larger issue with the MySQL Database.
Has anyone else had a similar problem? Any ideas how I can fix this?
This is the error I get from the MySQL Browser
Your connection attempt
failed for user 'admin' from your host to server at
ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com:3306: Can't connect to
MySQL server on 'ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com' (4)
Please: 1 Check that mysql is running on server
ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com
2 Check that mysql is
running on port 3306 (note: 3306 is the default, but this can be
changed)
3 Check the admin has rights to connect to
ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com from your address (mysql
rights define what clients can connect to the server and from which
machines)
4 Make sure you are both providing a password if needed and
using the correct password for
ec2-XXX-XXX-XXX-XXX.compute-1.amazonaws.com connecting from the host
address you're connecting from
The only possible problem I see could be #4, but I ran and re-ran this command via Terminal:
grant all privileges on *.* to 'admin'#'%' identified by '<pass>' with grant option;
When I am at the office, MySQL runs on a specific server which is called "mysqldev". In my /etc/hosts file I have set "mysqldev" to match the IP of this server. So far, so good. However, when I am out of the office using my laptop, I want to use my local MySQL database, as I clone specific databases there and have no internet to connect to the office database. I do not want to change my scripts, but rather my laptop configuration. So on my laptop I have set in /etc/hosts:
127.0.0.1 localhost mysqldev
However, for some reason this does not work as expected. If I log in to MySQL using the server at localhost, all good. But when I try to log in on the mysqldev server (same IP as localhost), I get the error:
Warning: mysqli::mysqli() [mysqli.mysqli]: [2002] Connection refused (trying to connect via tcp://mysqldev:3306)
(this is using PHP, but using the command line it is the same error)
The users that are set up on the system have specific permission to log in on this server:
CREATE USER 'test'#'mysqldev' IDENTIFIED BY '123';
GRANT ALL PRIVILEGES ON testdb.* TO 'test'#'mysqldev';
I have also turned off the firewall to test, and it does not make a difference. What could it be?
The MySQL client library tries to guess how to connect to your database. When you give localhost as the hostname, it assumes, that you're using a local socket (search your computer for a file named mysql.sock, probably under /var/lib/mysql or /usr/local/mysql/.
However, when you use anything else, like an ip address, a different hostname, or, in your case, mysqldev, it tries to connect to the host via tcp. From the error message, it seems as if your local mysql server is not listening on the tcp port 3306 (the mysql default)
Check, if your my.cnf (probably /etc/my.cnf or /etc/mysql/my.cnf) allows the use of tcp. If you find a line like
skip-networking
comment it out:
#skip-networking
and restart the server. Then try again to connect.
To find out, where your socket is, connect through localhost and issue the following command:
mysql> show global variables like '%socket%';
+---------------+-----------------------------+
| Variable_name | Value |
+---------------+-----------------------------+
| socket | /var/run/mysqld/mysqld.sock |
+---------------+-----------------------------+
If you are using MAMP Pro and are running into issues, you can simple uncheck the box labeled "Allow local access only" within the MySQL Server settings.