This is the query I'm running in PhpMyAdmin
.
SELECT
name,mobile,email,address
FROM
customer
WHERE
status = 'Active'
INTO OUTFILE 'C:/tmp/active_customers.csv'
FIELDS ENCLOSED BY '"'
TERMINATED BY ';'
ESCAPED BY '"'
LINES TERMINATED BY '\r\n';
And getting this error:
#1045 - Access denied for user 'root'@'localhost' (using password: YES)
Your user does not have permission to query SELECT FROM CUSTOMER
. In order to fix this (assuming you have SSH access) :
Connect to MySQL server using SSH using a user which has access (or owns) MySQL : ssh mysql@your_mysql_server.com
Login to MySQL server as root with password:
mysql -u root -p
Grant required permissions to the user you want (check the available permissions here ):
GRANT [ALL/SELECT/etc..] ON database.table TO 'lptool_app'@'localhost';
After finishing granting the privileges you want, It's best practice to reload all of the privileges:
FLUSH PRIVILEGES;
You can check the privileges granted to any user using this command :
SHOW GRANTS FOR 'user'@'server';
Using a privileged user (like root
), you can run the same queries with PHPMyAdmin as well.
NOTE: The permissions are granted to user@machine, not user only so, if you grant your permissions to a specific user@machine, your user won't have the same permissions from another machine. But if you are only working from PHPMyAdmin, as it runs on a server, your machine won't change, therefore you should not be having problems.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.