CREATE USER and GRANT to create a user that can access database from Power BI - mysql

I am pretty new in here and the answer might be obvious here but I am quite lost.
So, I have MySQL Database (hosted on Amazon AWS RDS). I would like to query data directly from power bi using a user (that is not the root user) with minimum privileges.
So here is the steps I did (done in MySQL Workbench):
I created a user named powerbi
CREATE USER 'powerbi'#'localhost' identified BY '12345'
I granted SELECT privilege to user
GRANT SELECT ON *.* TO 'powerbi'#'localhost'
I checked the user status using SELECT * FROM mysql.user
[Here is the output]
I want to try my connection by connecting it using MySQL workbench but I encountered an error
[connecting]
[connection error]
When I am trying to connect to the database using Power BI, here is the error I got:
[power bi error]
Any idea of what steps I missed?

i think Your Hosting Not Allow. MySql Database Remote access.
Check four point
IP Address or hosting Name
User Name
Passwords
database Name

Related

How to restrict the root MySQL system user to a single host in GCP Cloud SQL?

I am logged into MySQL with a user with full admin privileges, and wish to update the root user to only allow login via localhost.
Currently, the root user has full privileges via 'root'#'%', and I'd like to change that to 'root'#'localhost'. I've tested this out on a local mysql install and it worked fine. However, in GCP Cloud SQL I'm unable to do so.
Running:
RENAME USER 'root'#'%' TO 'root'#'localhost';
Yields the error:
ERROR 1221 (HY000): Incorrect usage of RENAME and SYSTEM USER
Is there any way to achieve what I want to do in locking down where the root user can login from? I would like to avoid any MySQL downtime if possible. I am using MySQL 5.7.
As per the document, because Cloud SQL is a managed service, it restricts access to certain system procedures and tables that require advanced privileges and that includes restricting the hostname for the default root user account.
What I can suggest is that you create another MySQL user on cloud console. That user have the same privileges as the root user plus you'll be able to restrict the hostname or limit the privileges for this user. In a way you can say that Cloud SQL encourages you to create separate user accounts for different purposes because the root user is a very common target for unauthorized access.

Is there another safer solution for accessing remotely to sql server than 'username'#'%'?

I am trying to access mysql server in office remotely from home by mysql workbench.
I already solved to connect remotely. I created an user by:
mysql> CREATE USER 'myusername'#'%' IDENTIFIED BY 'some_pass';
And, with this user, I can access the database remotely. But, I don't think it's safe. #'%' means that all hosts can access once they find out 'myusername' and 'some_pass'.
Instead of that, I would like to get it done by an user whose IP is specified. (after removing the user above), I created the user below by:
mysql> CREATE USER 'myusername'#'123.456.789.012' IDENTIFIED BY 'some_pass';
'123.456.789.012' here is the IP address of my home computer.(the number is dummy, though.). With user like this, it allows only the specified host to access. I think it is safer. But, I have already tried this and didn't work. I got the error below on mysql workbench on home computer when trying to connect remotely (by test connection from mysql workbench):
Failed to Connect to MySQL at XXX.XX.XX.XXX:3306 with user myname
Host 'XXX-XXX-XXX-XX-XX.abc.defg.hi.jk' is not allowed to connect to this MySQL server
I don't know why this error pops up.
and also, I tried the user with IP addresses like '123.456.789.%' or '%.456.789.012' which got the same error.
Is there another way to accomplish remote connection safer?

MySQL Access Denied for user ''#'localhost'

I am having trouble creating a database on my local server using MySQL.
Approach:
Start mysqld as administrator
Start MySQL as administrator
mysql> create database db_name;
MySQL throws an error indicating, "Access Denied for user ''#'localhost to database 'db_name'.
What do I need to specify to MySQL to create a database?
You need to provide a valid user/password combination to gain access to MYSQL.
You also need that the user you are using have the privileged to create a database.
On default, new users have zero access to the database management including creation.

Single user with multiple databases in Plesk 11

I am running Centos6 with Plesk 11 and I am trying to assign a single user to have access to multiple databases. I am following the instructions given here: http://kb.parallels.com/en/115783
When I run the command GRANT ALL PRIVILEGES ON newdb.* TO 'olduser'#'%'; from the SQL tab in phpmyadmin, I am getting the following error:
1044 - Access denied for user 'openemm2'#'%' to database 'openemm_cms'
openemm2 is the username I have assigned to this database -- why the error and what can I do about it?
Found the solution to this. I had to log into the mysql> prompt using:
mysql -uadmin -p`cat /etc/psa/.psa.shadow`
This allowed me access to run the command. I have also discovered one can accomplish the same thing through the phpmyadmin panel access through the database servers link from the servers tab in Plesk 11. This is where you find the master phpmyadmin where you can access ALL of your databases rather than the individual access phpmyadmin you get through the database link in the websites & domains tab.

How could I setup a user to be used with an ODBC in MySQL?

I've stablished an user that will be used for reporting in my Database. I've granted just SELECT privileges over the necessary database.
I'm able to log into MySQL from phpMyAdmin for example and I do with the user what is supposed to do.
However, the following error arises once you try to read from an ODBC:
[MySQL][ODBC 3.51 Driver]Access denied for user user#server_ip (using password: YES)
Do I need to do something extra? The access with root doesn't have this problems but, obviously, I don't want to grant all permissions to that user for security reasons.
You must first make sure that the user has your desired access when it connects locally. You can test this using the MySQL Query Browser or MySQL Command Line client.
Now, if there is no issue when tested locally, and if the root user is able to access the tables from the remote machine, then something must be wrong with the user's permissions which prevents it from accessing the tables from the remote host. Check if you have correctly granted the needed permissions to the user. Here is the correct syntax:
mysql> CREATE USER 'custom'#'host47.example.com' IDENTIFIED BY 'obscure';
mysql> GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP
-> ON expenses.*
-> TO 'custom'#'host47.example.com';
See Adding User Accounts in MySQL Reference Manual.