Unhandled exception: Error creating account - mysql

I'm trying to set up a database with MySQL and this error keeps popping up: Unhandled exception: Error creating account blank#blank. Error executing 'Access denied; you need (at least one of)the create user privileges for this operation.
I'm wondering if and how I can change my own account settings so that I'll be able to add new users again and be able to do other things. The program I'm currently using for this is MySQL workbench and I recently put the server onto a Microsoft web-matrix website. I'm not completely sure if that can cause any odd effects but I just want to be safe. Thanks guys.

Create a new connection in MySQL workbench with user root. Logon with that user in MySQL workbench and go to a Query window. Assuming you want to access everything and have all privileges, issue the following SQL statement. Replace 'you' with your username.
GRANT ALL PRIVILEGES ON * . * TO 'you'#localhost;
GRANT ALL PRIVILEGES ON * . * TO 'you'#'%';
That will give you pretty much everything.
Here is the Documentation

Related

MySQL ERROR 1396 (HY000): Operation DROP USER failed for 'username'#'localhost'

The software im using automatically creates 2 mysql users during installation. Because of a slight issue those users were created wrongly and the Support advised me to remove the users form the database and then recreate them using the installer (theres a separate option to just create the database users).
The two users are 'username'#'localhost' and 'username'#'%' (yes, they have the same username on different hosts..)
My problem is that neither DROP USER 'username'#'localhost'; nor DROP USER 'username'#'%'; work, both throw an ERROR 1396.
My guess would be that it has to do with the user accounts "owning" elements in the database which would be orphaned. Is there a way to get past this and remove the users anyways? (Since they are gonna be recreated in a second?)
Clarification: Im using the mysql root user.
Ergest Basha's suggestion in this comment worked for me:
You could try deleting from mysql database. use mysql; then delete from user where user='username' and host ='localhost';

The user specified as a definer does not exist - GRANT doesn't fix

After years of no problems with my PHP webapp running MySQL 5.5 on the backend, suddenly today I'm having permissions problems.
Whenever I try to run an INSERT statement (either from PHP or from Workbench or Heidi), I get this error message: The user specified as a definer ('my_user'#'1.2.3.%') does not exist
One symptom is that INSERT statements cannot be executed by my PHP nor by remote clients such as Workbench or Heidi. I have tried various solutions suggested by:
MySQL error 1449: The user specified as a definer does not exist
Error: 1449, "The user specified as a definer ('root'#'localhost') does not exist"
Everything points to running a GRANT statement. I have tried various GRANTs as suggested, but I always get this error:
Access denied for user
It seems like my permissions got corrupted or something. So I created a brand new DB user inside BlueHost control panel on my VPS and gave full privileges. I get the same exact errors on this brand new user.
BlueHost support has no idea what to do.
Some Stack articles say to go mess around with TRIGGERS or STORED PROCS permissions - but I don't have any of these types of objects. Simple INSERT statements cause this error, and perhaps UPDATEs as well, but I'm not sure of that at this moment.
The user has FULL PRIVILEGES, as always.
What else can I try? Is there some way to fix corrupted permissions? I can run SELECT statements with no problems.
I tried connecting to the DB with root (using the same pwd as I use when connecting to WHM), but it didn't like my password or maybe the user in general. I never set up root as a specific user against this DB and I'm not sure that's a good idea. I have always used a specific user created just for this DB. Again, past 5 years no problems at all. The DB has not been upgraded, no DB changes, no user changes, nothing.
I sort of solved it. I ended up creating a new database with a different name, and created a new admin user to go with it. Then I ran my db backup/dump script against it. Everything works perfectly again, with this new DB. The old DB is still jacked.
I'm thinking that permissions got corrupted in the old database.

MYSQL - copy table error / user permission error

I'm trying to copy a table from one database to another and I keep getting errors. I'm not sure which one to troubleshoot specifically or if I'm even going in the right direction. Any ideas?
CREATE TABLE _pw_users.items LIKE _users.items;
INSERT INTO _pw_users.items SELECT * FROM _users.items;
And I get this error:
CREATE command denied to user 'xxxxxx'#'localhost' for table 'items'
So I try to allow permissions with this:
GRANT ALL PRIVILEGES ON `_pw_users`.* TO 'xxxxxx'#'localhost'
And I get this error:
"#1044 - Access denied for user 'xxxxxx'#'localhost' to database '_pw_users' "
I'm not sure where I should go from here.

MySQL user with ALL PRIVILEGES can login but not run queries

We've configured our Plesk machine to use an external MySQL server. In doing so, we've granted ALL privileges WITH GRANT OPTION to the psaadmin user so we are able to create remote databases and users just fine. However, the users we create (i.e. 'wordpress_user') cannot run select statements on the remote server.
In checking permissions on the MySQL server, 'wordpress_user' has ALL PRIVILEGES to the database itself. I'm able to login to phpMyAdmin with that user and I'm able to login on the remote server console with that user. It's only when I try to run any query as that user that I get a 'ERROR 1045 (28000): Access denied for user' error.
Everything I've checked seems to indicate the user has full permissions. I've also used FLUSH PRIVILEGES as instructed by the docs. I've restarted Plesk, restarted MySQL, still nothing.
Can anyone help? Please?
I was able to find the problem. Apparently the problematic query was a view that had specific permissions? Regular selects, etc. worked fine (I didn't realize that). I was able to drop and recreate the view and it works great now.

Can't alter MySql routine

I am logging in with my main DB user, into Phpmyadmin page/ workbench remote access application and I have permissions issues.
It all started when I tried to alter routines that I have stored in the DB. when trying to alter those routines from the workbench applications nothing just happens.
I can call these routines and execute them, but not alter or get to the scripts.
I searched for hours in distinct forums and get some answers regarding grant access commands
but then I got again permissions issues with error #1142 , command denied to user(main user).
I am really lost here, and already lost hours of work in order to get to the scripts of my routines.
one last note - I have created these routines while I was connected with the same user but from different remote connection (different IP address).
Would really appreciate the help.
here is a solution how I fixed this:
1) Add "mysql" database to the user, you are logged in with
Advice: now you can alter functions and procedures
2) Add the global privilege "SUPER" to your user
Advice: otherwise you will get the following error if you save the procedure/function: "ERROR 1227: Access denied; you need (at least one of) the SUPER privilege(s) for this operation"
CREATE DEFINER = 'admin'#'localhost' PROCEDURE account_count()
SQL SECURITY INVOKER
BEGIN
SELECT 'Number of accounts:', COUNT(*) FROM mysql.user;
END;
See the above example.
You need to login using super user and change the definer parameter in the procedure based on your new username and hostname. The same definer who created can edit the stored procedure.