MySQL users: When localhost changed to %, I cannot login - mysql

I am developing an app with MySQL. I have MySQL (XAMPP) running on my PC. All works fine but now I want to let other users from our network to login, but I found out that when I change user property "localhost" to % (any computer) I get access denied even with my own account.
So, in the short, everytime I change "localhost" to "%" (any computer) I get "access denied". When switch back to localhost I can log easily.
What is wrong please?
Thank you

In MySQL, user#localhost and user#% are two completely different and unrelated users. You need to grant access to your data (and, if applicable, set a password) for user#% in addition to granting access for user#localhost. One does not also provide the other.

Related

how to connect to azure database for mysql, from azure app service with wordpress docker image?

I have an azure app service, using the latest wordpress image from docker hub. The screenshot for the azure app service:
Then in the azure app service -> application setting, I added the following key/value pairs which will be used to connect Azure database for mysql:
WORDPRESS_DB_HOST
WORDPRESS_DB_NAME
WORDPRESS_DB_PASSSWORD
WORDPRESS_DB_USER
screenshot:
Inside my Azure database for mysql, I have enabled public access / allow public access from any azure service / also add my client ip and this ip range 0.0.0.0 - 255.255.255.255. I can access it from my client and create the database which will be used by azure app service. Screenshot like below:
in server parameters, I also turn off the require_secure_transport setting:
At last, I tried to launch the site, but it throws the error "Error establishing a database connection", screenshot below:
I'm new to wordpress / docker, and don't know how to fix this issue. I also reviewed some videos / docs, and didn't see any other configuration differences. Could you please guide me how to fix this issue? Thanks very much.
You received this error message.
Warning: mysqli_real_connect(): (HY000/1045)>: Access denied for user 'ivan'#'52.xx.xxx.xx' (using password: YES)
It means MySQL received, processed, and rejected your WordPress instance's attempt to connect. So you know the hostname is right and your cloud provider's firewall settings allow your WordPress instance to exchange network data with your MySQL instance.
What's wrong?
MySQL's user name / account name setup has a quirk. An account name can look like 'ivan'#'localhost' or 'ivan'#'%' (or even something like 'ivan'#'192.0.22.33').
The first of those only allows login from localhost (or via tunneling via ssh). The second allows login from '%', meaning any host. You need the second one for your WordPress instance to get access to MySQL.
When you're logged in to MySQL from your machine, do this.
SELECT host, user FROM mysql.user WHERE user='ivan';
You should see two rows, like these
host user
---- ---
% ivan
localhost ivan
It's possible the account with '%' as the host is missing. If so that means you need to create another MySQL account and give it access to your database. Do that like this.
CREATE USER 'ivan'#'%' IDENTIFIED BY 'your_password';
FLUSH PRIVILEGES;
Next, make sure the user account you just created -- the one your WordPress software will use to connect to MySQL -- has access to your database.
GRANT ALL PRIVILEGES ON wordpress.* TO 'ivan'#'%';
FLUSH PRIVILEGES;
If you still get the error message, it's possible the password on your 'ivan'#'%' account doesn't match what you put into your WordPress configuration. You can change it with
ALTER USER 'ivan'#'%' IDENTIFIED BY 'your_password';
FLUSH PRIVILEGES;
If it still gives the same error message, it's possible that your cloud vendor requires TLS to connect to MySQL. You may want to consult their support team about that.
(This is a common stumbling block setting up new WordPress instances.)
ok just to keep and make things clear. all IPs can connect to the DB but are you actually authorized to read/write date in the DB?
I.E. this might be a permission/privilege issue.
I suggest double checking user privileges and determine who can do what on your DB
Best Regards. :-)

Handling users of phpMyAdmin

Hi stackoverflow community,
I have some doubts in how to manage the users in phpMyAdmin, I am starting a project but I see multiple users with ALL PRIVILEGES.
I should choose one user, set my password, and then delete the other ones?
Having multiple users with ALL PRIVILEGES and without any password can be a security trouble?
What is the difference between the root users? And servers 127.0.0.1, ::1 and localhost?
I leave here an image to be more specific and show graphically what I meaning.
http://i.imgur.com/w2Ga8XS.jpg
http://i.stack.imgur.com/hVFW7.jpg
I would appreciate detailed and understandable answers.
Thank you in advance.
MySQL allows you to restrict permissions to a username, host pair. This means that the user only has the permissions when they login from the specified host. Typically you restrict MySQL admin permissions only if the user on the local machine (ie: the one that is running MySQL). The local machine can be called localhost, 127.0.0.0, or, in IPv6, ::1. So you only have one root user. They will only be given admin privileges when they login from the local host. You shouldn't delete any of them. You should set the password on the ::1 line (I don't know why it's not set).

Access denied for user 'root'#localhost' (using password: YES)

I am using a piece of hardware called a Meshlium AP, which I use to estimate where people are based on smartphone pings. If I am connected to the meshlium network I can access the management panel at 10.10.10.1.
Originally, I was working on a Windows Laptop and when connected to the Meshlium network, within their Management system (located at 10.10.10.1) I have the option to go to phpMyAdmin on local host to download the SQL data. I was able to login with the supplied username and password. I am still able to do this easily
I am now working on a Mac and when I attempt to login phpMyAdmin through their management system, I get this error "Access denied for user 'root'#localhost' (using password: YES)". I am using the same username and pass that still currently works on the PC
I have a feeling it might be some permission issues, but I have no idea how or what to change.
Any thoughts on how or what permissions I can change to gain access?
If you're sure that the password is correct then it sounds like the 'host' for the user is only localhost, and not setup to allow other hosts (even on LAN) to connect.

Cannot connect to Google Cloud SQL using a not root account from GAE

I'm having a problem with trying to stablish a database connection with an user that's not root. I mean I have defined the following user at my database.
dev#host
I try to connect the way indicated here: https://developers.google.com/appengine/docs/java/cloud-sql/, but I get a truly strange error, I've set the application to display what error is the one that doesn't allow to connect with that user and I get this:
java.sql.SQLException:Access denied for user 'dev#host'#'localhost'.
I wonder where it can get that localhost from... I've also tried to change the name of the user to dev'#'host but it keeps on the localhost issue.
If I connect with root, not inputting any user or password it connects properly, but I need the application to be connected by users with less privileges.
Any idea what I can be doing wrong?
Thanks for your help.
Check this page…you need to set up permissions…
https://developers.google.com/cloud-sql/docs/access-control?hl=pt
Are you using a mySql client? Did you manage to add an authorized IP address?
Cheers.

Mysql query browser (an external program) cant see all databases

I have a database to work with. There is phpMyAdmin and it works good but I want to use an external database manager. I use the same login account what PhP script uses, still query browser doesnt see a database.
Anyone can know why?
I would guess that with phpMyAdmin, you are accessing MySQL from the WebServer that has IP address 1.0.0.1.
Then, from the external DB manager, you are accessing from IP address 1.0.0.2.
MySQL handles authentication and authorization using IP address (among other things) to authorize. So it's probably the case that you don't have all permissions for 1.0.0.2 in your MySQL database.
Your account is probably limited to 'localhost' only, try adding 'user'#'remote-ip' aswell.
For example:
GRANT ALL ON db.* TO 'jsmith'#'office.example.com' IDENTIFIED BY 'password';
FLUSH PRIVILEGES;