MySQL Access Denied for user ''#'localhost' - mysql

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.

Related

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

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

How to create MySQL DB in PhpStorm?

I am trying to create a new MySQL DB in PhpStorm, but when I add table to information_schema I get this error:
Access denied for user ''#'localhost' to database 'information_schema'
In addition, when I create a new DB and test connection I get this pop-up window:
The specified user/password combination is rejected: "[42000][1044] Access denied for user ''#'localhost' to database 'db'"
and I don't have password.
First of all the information_schema Database is the MySQL system schema. You shouldn't try to edit this Database
If you want to create a new table you should create that table in a new database. If your credentials are right you're able to create new databases running the following command in the console of your MySQL environment.
create database <database_name>

Create a new user without root password

I have to create a database in a Windows Server 2008 remote machine, which already had MySql Server 5.5 and MySql Workbench 5.2 installed. Since I wasn't granted the password to the root user, I tried to create a new user.
In MySql Workbench I tried to open the Manage Security option, to no avail, since it asked for the password.
In the command prompt I tried to run mysql but it returned the following error message.
ERROR 1045 (28000): Access denied for user 'ODBC'#'localhost' (using password: NO)
Is there any way to create a new user without having prior access to the root user?
More generally, is there any workaround to create and use a database without access to root?
You don't have to be the root user, but you must have rights to create a user. You can get those rights with the grant create user statement. Apparently, you don't have those privileges, so if you need them, you should ask your administrator.
So the answer is: There is no workaround. You don't have to be root, but you must have certain privileges.
In practice, if you need an extra user, the administrator is more likely to create one for you than to give you the rights to create them yourself. But that's something he and you need to figure out yourselves. :)

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.