I am running into a permission error when trying to load data from a flat file database dump into a new table. I know that the schema of the file and my table is the same and I tried tweaking the permissions. What else should I try?
mysql> load data infile 'myfile.txt' into table mytable fields terminated by ',' enclosed by '"';
ERROR 1045 (28000): Access denied for user 'user'#'%'
grant all on mytable.* to 'user'#'%
Here's a thread on the MySQL forums that discusses exactly this.
Here's the answer, posted by Ken Tassell
Problem resolved using the command below:
grant file on *.* to kentest#localhost identified by 'kentest1';
You might have MySQL privileges on the destination table, but you also need the FILE privilege to execute LOAD DATA, and of course the MySQL Server process needs operating-system privileges to the data file too.
Related
My website works fine except when I execute back-up function for mysql it throws this error :
SQLSTATE[28000]: Invalid authorization specification: 1045 Access denied for user 'username'#'localhost' (using password: YES) (SQL: SELECT * INTO OUTFILE '/archive/db-backup-date-09-09-2015-time-10-30-04/accounts.csv' FROM accounts)
i tried this statment :
GRANT FILE ON \*.\* TO 'username'#'localhost'
but it throws another error
#1045 - Access denied for user 'myHostingUserName'#'localhost' (using password: YES)
note that in this error it the user for who access is denied is my hosting user name (hostgator), but I don't have MySql user with this name
Actually mysql does not rights outside so you need to export your file within mysql, you can use as per below-
SELECT * INTO OUTFILE '/tmp/accounts.csv' FROM accounts;
assuming /tmp is a directory where mysql is creating temp files.
Also aussing that your csv creation command is fine for you as you are not managing fields seperation etc. issues in it.
Regarding 2nd error, you don't have permission to grand rights.
I work on a personal website. I just put it on the production server. When I am in the development environment I connect to MySQL with root but now I just created a user specific for this website. So I wrote this command line in MySQL:
GRANT USAGE ON portefolio.* TO 'userPortefolio'#'localhost' IDENTIFIED BY PASSWORD 'myPasswordCrypted'
The query is ok, but on my website, when I try to access a page with a query, Symfony gives me that error:
SQLSTATE[42000] [1044] Access denied for user 'userPortefolio'#'localhost' to database 'portefolio'
I tried to restart the server to be sure everything is ok but nothing.
I encrypted the password with the MySQL function
password('my password not encrypt')
and in Symfony I wrote the password in non-encrypted format. Is that ok?
GRANT USAGE ON portefolio.* TO 'userPortefolio'#'localhost' IDENTIFIED BY PASSWORD 'myPasswordCrypted'
Your password should not be encrypted in this statement. MySQL crypts it automatically.
Assuming no quirks in connecting etc were made you should do a
flush privileges;
after running the grant query.
quoting from the manual: The USAGE privilege specifier stands for “no privileges.”
so everything seems to be working as designed.
I am using xampp om windows 7. I logged in as the root user with the password i have set up. I created a new database(I am using xampp for the first time). and I am not getting any option for creating any tables in it.
It shows the following error:
Error
SQL query: DocumentationEdit
SELECT `tables`
FROM `phpmyadmin`.`pma_recent`
WHERE `username` = 'root'
MySQL said: Documentation
#1142 - SELECT command denied to user ''#'localhost' for table 'pma_recent'
How do I get rid of this?
I get this line also, somewhere at the bottom of the page along with the error message:
The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated.
http://dev.mysql.com/doc/refman/5.1/en/grant.html
GRANT SELECT ON db.table TO 'user'#'localhost';
GRANT ALL ON db1.* TO 'jeffrey'#'localhost'; ------------ i think this is much better.
I'm trying to get the examples to work in Agile Toolkit, but I get the database connection failed error. I created a MySQL database, imported the schema.sql file, and updated the config.php file with the correct database name, database username, and password.
Here's the DSN line in config.php (fake username:password substituted)
$config['dsn']='mysql://admin123:pw12345#localhost/ATKexample';
It seems to be pointing to the right place, because the error changes if I put the wrong password into config.php. The first error message below is what I get with the correct password, and the second one below is what I get if I use an incorrect password.
PDO error: SQLSTATE[42000] [1044] Access denied for user
'admin123'#'localhost' to database 'ATKexample'
PDO error: SQLSTATE[28000] [1045] Access denied for user
'admin123'#'localhost' (using password: YES)
I can't figure out what I'm doing wrong. I don't know if it is a problem with the way the MySQL database is setup or if I need to change something in my ATK example files. Can anyone suggest a troubleshooting strategy?
Edit: I didn't have my user privileges setup right in MySQL. Problem solved.
Log into your mysql console and grant permissions for user admin123
grant all on `ATKexample`.* to 'admin123'#'localhost' identified by 'pw12345';
I'm using MySQL given from A2Hosting. There I can create users and add them to databases. And i hosted my php codes inside web folder in symfony php structure. I dont want to use any symfony commands or functions. I have my own php calls to DB. But my Php codes gives the following error. But the user names and passwords are correct.
Query failed : Access denied for user 'games_user'#'localhost' to database 'games'
Granting privileges to user 'games_user' could not be enough. You must grant privileges to 'games_user'#'localhost', specifiying the host, even for localhost.
Granting all privileges for instance should look like this:
GRANT ALL PRIVILEGES ON database.* TO 'games_user'#'localhost' IDENTIFIED BY 'password';
Check permissions for user "games_user" in your "games" database. Access is denied to database "games"