no privilege in PhpMyAdmin from Wamp - mysql

I have been messing around trying to solve this problem for awhile now and I probably messed something up. I have been going around the forums and nothing has been working. First I forgot my password to root and used the command --skip-grant-tables to try to change it. I am able to login into root now on phpmyadmin with my password just being empty. On phpmyadmin it shows User: root#localhost. Then when I try to create a new database there is only a red x and is says No Privileges.
Also if I try to create a password to root I get an error that says - Can't find any matching row in the user table.
I saw on a forunm that said to run this code
select Host, User, Select_priv from mysql.user
but what I get it SELECT command denied to user ''#'localhost' for table 'user'
thanks for the help.

The following command can be used to set the password for the root user and grant all privileges:
UPDATE mysql.user SET Password=PASSWORD('NewPasswordHere') WHERE User='root';
GRANT ALL PRIVILEGES ON *.* TO 'root'#'localhost';
FLUSH PRIVILEGES;
Place this SQL code into a text file and save it some place convenient. Then, kill the SQL server. Open a command prompt and cd to the directory where the mysql-nt executable is stored. Execute this command:
mysqld-nt --init-file=sql-file-saved-above.txt
Kill the SQL process you just started and restart the server normally and all should be good. Depending on how you have phpMyAdmin configured, you might need to adjust its configuration if you have the root password saved there.

your best option is to set add a new user with a password and grant FULL privildeges, on you connection use the new user
Open PhpMyAdmin
select "Users"
underneath the know users is the option "add user"
add login information as required
tick the 2 boxes in the "database for users section"
now "Check All" in the Global privideges and click go, new user is then set up and you can use it as your new connection

go to Php My Admin home page of wamp
At the very top in grey you can see your connection is "localhost"
Underneath where you see your connection is local, are 10 tabs which are......
Databases |
SQL |
Status |
Users |
Export |
Import |
Settings |
Binary log |
Replication |
More
as you can see option 4 is "Users"

Related

1044 - Access denied for user 'user'#'localhost' to database 'db'

I tried a lot to import the sql script to create database and tables through phpmyadmin in the new site I hosted. But i'm getting the error,
1044 - Access denied for user 'user'#'localhost' to database 'db'
I tried to create a sample db directly : create database sampled; I'm getting the same access denied error.
I'm not able to grant privileges to the user also, i'm getting the same access denied error.
Following is the output of show grants command,
show grants;
GRANT USAGE ON . TO 'someuser'#'localhost' IDENTIFIED BY PASSWORD 'somepw'
GRANT ALL PRIVILEGES ON someuser\_%.* TO 'someuser'#'localhost'
Any help would be appreciated. thank you.
If you are using Godaddy then don't directly go to phpMyAdmin and run the sql command.
You have to go to MySQL® Databases section and create a database there.
Then create a user and give it the permission to access the database you just created.
Now you can go to phpMyAdmin and write your SQL commands.
Hope this helps
It is clear that the user someuser do not have proper privilege over the database db. You need to grant privileges for the user over the database to correct this issue.
If you do bot have administrative rights contact your admin for granting privileges to someuser on that db
For me the problem is I'm not having permissions to Create new Databasename or even Modify the name of the Database. You can contact your admin to avail privileges or if you want to quickly import the .sql file... then you can open the .sql file with text editor and find the following line:
CREATE DATABASE IF NOT EXISTS `enter the existing db name` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `enter the existing db name`;
After that try to import the .sql file...now you can successfully import all the tables!
This error can be avoided in the beginning when creating the user account. Following commands must be used to create user account having all the PRIVILEDGES.
CREATE USER 'demouser'#'localhost' IDENTIFIED WITH mysql_native_password BY '***';
GRANT ALL PRIVILEGES ON *.* TO 'demouser'#'localhost' WITH GRANT OPTION;
ALTER USER 'demouser'#'localhost' REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
CREATE DATABASE IF NOT EXISTS 'demouser';
GRANT ALL PRIVILEGES ON `demouser`.* TO 'demouser'#'localhost';
Must Ensure that your User_Name, Password and Database name are correct.
If you are Deal with database 'sampled' then type 'sampled' in query instead of 'db' also must ensure that you don't have to use quota(') in Statement.
you have not exported database from localhost or from web server correctly follow these steps go to localhost database click export tab than select 'Custom - display all possible options 'check box few options will open in section 'output' change compression none to zipped and now click go button at bottom it will properly export your database you can now import to hosting or anywhere you want with no errors
I had the same problem i solve it buy change the GRANTEE and made the user he can do all the operation in PhpMyAdmin ,follow the steps :
Enter to mysql in root permission but :
sudo mysql
Enter the password, and type this :
SELECT * FROM information_schema.user_privileges;
And see the user in IS_GRANTABLE is he yes or no.
If he yes then see the PRIVILEGE_TYPE what it might it be just tow operation if it's true add the last operations.
and see this link to change IS_GRANTABLE from no to yes.
I wish this could help you.
I started getting this error message for no reason at all. Solved by using MySQL and the Server menu option; Selected my bitnami_wordpress schema; selected the bn_wordpress user; then picked the Administrative Roles tab and granted access to this user. I had to do this to all of the users that the access was removed from.

How to see all databases in phpMyAdmin as phpmyadmin user?

I have been using MySQL successfully using the command line, and have created various databases (mostly for CMS).
I decided to try using phpMyAdmin which I saw mentioned in a book on Joomla!.
But when I click on Databases, I only see information_schema, phpMyAdmin, and test.
I want to be able to administer all of my databases (presumably giving appropriate credentials). Probably related is the fact that if I log into mysql as the phpmyadmin user and do a show databases; query, I see only those three databases.
Do I need some sort of a grant involving the show_db_priv (granting to the phpmyadmin user)? If that's it, what is the exact syntax for doing that? When I do a show grants for this user, I can see that show_db_priv is not one of them.
Login as MySQL root user in phpMyAdmin. If you're not able to login as root in-spite of providing correct password, then make sure that you have this line in your phpMyAdmin's config.inc.php and is set to true.
$cfg['Servers'][$i]['AllowRoot'] = true;
If you've not assigned password to MySQL root account, then default password is blank. In that case check that AllowNoPassword is set to true in phpMyAdmin's config.inc.php
$cfg['Servers'][$i]['AllowNoPassword'] = true;
Not sure if this answer is relevant, as I am using phpMyAdmin as part of WAMP on a single site machine. Still, it might help someone else running into the problem of phpMyAdmin not displaying existing databases.
After installing WAMP on a new machine (with phpMyAdmin 4.0.4), and using a php script of mine to create some databases, phpMyAdmin would only show the information_schema and test databases.
When I ran mysql from a command prompt, the databases were there, so wtf??
After some experimenting I discovered that adding the following line cured the problem:
$cfg['Servers'][$i]['auth_type'] = 'config';
Note that the config.inc.php already had
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['AllowNoPassword'] = true;
$cfg['Servers'][$i]['AllowNoPasswordRoot'] = false;
$cfg['Servers'][$i]['password'] = 'mypwd';
Note: The auth_type parameter is discussed in http://wiki.phpmyadmin.net/pma/auth_types,
but I don't see any comment on failure to show user created databases.
More details:
Without the auth_type line, a SHOW GRANTS (from phpMyAdmin) yields:
GRANT USAGE ON . TO ''#'localhost' IDENTIFIED BY PASSWORD '*CF74EB88D030BC86A14151B7CE22C8808A19AA4B'
With the auth_type line, SHOW GRANTS yields:
GRANT ALL PRIVILEGES ON . TO 'root'#'localhost' IDENTIFIED BY PASSWORD '*CF74EB88D030BC86A14151B7CE22C8808A19AA4B' WITH GRANT OPTION
GRANT PROXY ON ''#'' TO 'root'#'localhost' WITH GRANT OPTION
The easy way:
GRANT ALL PRIVILEGES ON *.* TO 'phpmyadmin'#'localhost' WITH GRANT OPTION;
FLUSH PRIVILEGES;
Those two lines will grant all privileges for the user phpmyadmin. You might need to restart mysql service.
If you didn't have a user named phpmyadmin in the first place, you can create it with the following:
CREATE USER 'phpmyadmin'#'localhost' IDENTIFIED BY 'your_secret_password';
This answer definitely exists somewhere else, but I can't find it to give it credit.

MySQL Error #1133 - Can't find any matching row in the user table

Unable to set password for a user using 3.5.2.2 - phpMyAdmin for 5.5.27 - MySQL. When trying to set the password while logged onto phpMyAdmin as the user, it pops up the following error:
#1133 - Can't find any matching row in the user table
When logged on as root, following password set successfully message pops up.
SET PASSWORD FOR 'user'#'%' = PASSWORD( '***' )
In either case, password does not set and stays as it currently is, blank.
I encountered this error using MySQL in a different context (not within phpMyAdmin). GRANT and SET PASSWORD commands failed on a particular existing user, who was listed in the mysql.user table. In my case, it was fixed by running
FLUSH PRIVILEGES;
The documentation for this command says
Reloads the privileges from the grant tables in the mysql database.
The server caches information in memory as a result of GRANT and CREATE USER statements.
This memory is not released by the corresponding REVOKE and DROP USER statements, so for
a server that executes many instances of the statements that cause caching, there will be
an increase in memory use. This cached memory can be freed with FLUSH PRIVILEGES.
Apparently the user table cache had reached an inconsistent state, causing this weird error message. More information is available here.
This error can occur if trying to grant privileges for a non-existing user.
It is not clear to me what MySQL considers a non-existing user. But I suspect MySQL considers a user to exist if it can be found by a name (column User) and a host (column Host) in the user table.
If trying to grant privileges to a user that can be found with his name (column User) but not by his name and host (columns User and Host), and not provide a password, then the error occurs.
For example, the following statement triggers the error:
grant all privileges on mydb.* to myuser#'xxx.xxx.xxx.xxx';
This is because, with no password being specified, MySQL cannot create a new user, and thus tries to find an existing user. But no user with the name myuser and the host xxx.xxx.xxx.xxx can be found in the user table.
Whereas providing a password, allows the statement to be executed successfully:
grant all privileges on mydb.* to myuser#'xxx.xxx.xxx.xxx' identified by 'mypassword';
Make sure to reuse the same password of that user you consider exists, if that new "MySQL user" is the same "application user".
Complete the operation by flushing the privileges:
flush privileges;
I encountered this issue, but in my case the password for the 'phpmyadmin' user did not match the contents of /etc/phpmyadmin/config-db.php
Once I updated the password for the 'phpmyadmin' user the error went away.
These are the steps I took:
Log in to mysql as root: mysql -uroot -pYOUR_ROOT_PASS
Change to the 'mysql' db: use mysql;
Update the password for the 'phpmyadmin' user:
UPDATE mysql.user SET Password=PASSWORD('YOUR_PASS_HERE') WHERE User='phpmyadmin' AND Host='localhost';
Flush privileges: FLUSH PRIVILEGES;
DONE!! It worked for me.
It turns out, the error is very vague indeed!
1) Password was setting while logged on as root, as it was updating the user/password field in the users table under MySql.
2) When logged on as user, password was in fact not changing and even though there was one specified in the users table in MySql, config.inc.php file allowed authentication without password.
Solution:
Change following value to false in the config.inc.php.
$cfg['Servers'][$i]['AllowNoPassword'] = true;
So that it reads
$cfg['Servers'][$i]['AllowNoPassword'] = false;
Change user's host from Any or % to localhost in MySql users table. This could easily be achieved via phpMyAdmin console.
These two changes allowed me to authenticate as user with it's password and disallowed authentication without password.
It also allowed user to change its password while logged on as user.
Seems all permissions and the rest was fixed with these two changes.
To expound on Stephane's answer.
I got this error when I tried to grant remote connections privileges of a particular database to a root user on MySQL server by running the command:
USE database_name;
GRANT ALL PRIVILEGES ON *.* TO 'root'#'%';
This gave an error:
ERROR 1133 (42000): Can't find any matching row in the user table
Here's how I fixed it:
First, confirm that your MySQL server allows for remote connections. Use your preferred text editor to open the MySQL server configuration file:
sudo nano /etc/mysql/mysql.conf.d/mysqld.cnf
Scroll down to the bind-address line and ensure that is either commented out or replaced with 0.0.0.0 (to allow all remote connections) or replaced with Ip-Addresses that you want remote connections from.
Once you make the necessary changes, save and exit the configuration file. Apply the changes made to the MySQL config file by restarting the MySQL service:
sudo systemctl restart mysql
Next, log into the MySQL server console on the server it was installed:
mysql -u root -p
Enter your mysql user password
Check the hosts that the user you want has access to already. In my case the user is root:
SELECT host FROM mysql.user WHERE user = "root";
This gave me this output:
+-----------+
| host |
+-----------+
| localhost |
+-----------+
Next, I ran the command below which is similar to the previous one that was throwing errors, but notice that I added a password to it this time:
USE database_name;
GRANT ALL PRIVILEGES ON *.* TO 'root'#'%' IDENTIFIED BY 'my-password';
Note: % grants a user remote access from all hosts on a network. You can specify the Ip-Address of the individual hosts that you want to grant the user access from using the command - GRANT ALL PRIVILEGES ON *.* TO 'root'#'Ip-Address' IDENTIFIED BY 'my-password';
Afterwhich I checked the hosts that the user now has access to. In my case the user is root:
SELECT host FROM mysql.user WHERE user = "root";
This gave me this output:
+-----------+
| host |
+-----------+
| % |
| localhost |
+-----------+
Finally, you can try connecting to the MySQL server from another server using the command:
mysql -u username -h mysql-server-ip-address -p
Where u represents user, h represents mysql-server-ip-address and p represents password. So in my case it was:
mysql -u root -h 34.69.261.158 -p
Enter your mysql user password
You should get this output depending on your MySQL server version:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.31 MySQL Community Server (GPL)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
Resources: How to Allow Remote Connections to MySQL
That's all.
I hope this helps
grant all on newdb.* to newuser#localhost identified by 'password';
For someone who is doing a mistake like me.
I was using command
SET PASSWORD FOR root = 'elephant7'
to update the password for the root user and I was getting the same error. I tried every thing mention above in all the answer but I got no success then after searching a bit I found out the ans,
MySQL account names consist of a user name and a host name. This enables creation of accounts for users with the same name who can connect from different hosts.
on https://dba.stackexchange.com/
and then I used the command
SET PASSWORD FOR 'root'#'localhost'=PASSWORD('mynewpasword');
here 'root'#'localhost' did the trick and the command worked.
Hope this be beneficial for someone.
If you're using PHPMyAdmin you have to be logged in as root to be able to change root password. in user put root than leave password blank than change your password.
In my case I had just renamed the Mysql user which was going to change his password on a gui based db tool (DbVisualizer). The terminal in which I tried to 'SET PASSWORD' did not work(MySQL Error #1133).
However this answer worked for me, even after changing the password the 'SET PASSWORD' command did not work yet.
After closing the terminal and opening new one the command worked very well.
I think the answer is here now : https://bugs.mysql.com/bug.php?id=83822
So, you should write :
GRANT ALL PRIVILEGES ON mydb.* to myuser#'xxx.xxx.xxx.xxx' IDENTIFIED BY 'mypassword';
And i think that could be work :
SET PASSWORD FOR myuser#'xxx.xxx.xxx.xxx' IDENTIFIED BY 'old_password' = PASSWORD('new_password');

Phpmyadmin - Mysql no privileges

I installed wamp 2.1 on windows 7. However when i open phpMyAdmin, I get the error, Mysql 'No Provileges'. I uninstalled wamp and reinstalled it a few times, but it doesn't help. Does anyone know how to solve this issue?
Also, when i tried creating a database from mysql console, i am getting the following error:
ERROR 1044 <42000>: Access denied for user ''#'localhost' to database 'a_db_name'
Thank God and to all helped.
Its simple.
Must! click logout icon in phpadmin page
In login page, type:
username:root password: (blank)
surprise. now you can happily create your database.
Are you logging into MySQL as root? You have to explicitly grant privileges to your "regular" MySQL user account while logged in as MySQL root.
First set up a root account for your MySQL database.
In the terminal type:
mysqladmin -u root password 'password'
To log into MySQL, use this:
mysql -u root -p
Edit:
To set the privileges manually start the server with the skip-grant-tables option, open mysql client and manually update the mysql.user table and/or the mysql.db tables. This can be a tedious task though so if what you need is an account with all privs I would do the following.
Start the server with the skip-grant-tables option
Start mysql client (without a username/password)
Issue the command
flush privileges;
which forces the grant tables to be loaded.
Create a new account with the GRANT command something like this (but replacing username and password with whatever you want to use.
GRANT ALL on *.* to 'username'#'localhost' identified by 'password';
Restart the server in normal mode (without skip-grant-tables) and log in with your newly created account.
Refer this MySQL docs.
Take a look at my topic regarding this issue, which takes some of the above.
MAMP mysql broken root user
You need to shutdown your mysql install and restart it from the command line properly like is indicated above. In my topic I have full clear instructions on how to do so. My instructions are for MAMP but you should be able to adapt it for your install.
Simple solution. Just find the icon right to "home" in PhpMyAdmin and click to logout. Then login using username "root" and password ""(blank). This will work accordingly.
username ought to be root and keep the password null(keep the password field blank)
right click on the wamp icon and goto mysql console.
Login with password if you have set any.By default the password is blank and username is 'root'
Once you are in mysql prompt execute
FLUSH PRIVILEGES;
now quit the command prompt and you are good to go.
in step 1 .inter your databasevery important.
in step 2 .select your database via all tables .
in step 3. backup type=replace & export.
in step 4 import database in my sql.
attention please:in import your database...
all table must view & selected in step 4.

unable to change to different user in mysql

I am also using windows 7.I installed mysql server 5.1.
Created a user as 'user#localhost' using mysql console. But unable to login to that user.
I tried to run using command prompt.
When I created a user with name "user". when i tried mysql -u user -p
It says Access Denied to 'user#localhost' ..
Even trying with mysql console is not helping out here. .
A few things to try:
Make sure your user has the correct privileges set (global or schema level privileges)
try running FLUSH PRIVILEGES
To help us troubleshoot, what does this command return? SHOW GRANTS FOR 'user'#'localhost';