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"
Related
Im trying to access an sql database on c panel through a web hosting server. I have a user that has been created for the database and it has been granted all privileges. When I try to access the database through my domain+file path I get an error: Access denied for user "#localhost" using password yes on c panel.
I have tried command
SHOW GRANTS;on the database, and it get the following:
GRANT USAGE ON *.* TO 'cpses_hagmkcyksn'#'localhos...
GRANT ALL PRIVILEGES ON****_testdata.* TO ...
Any suggestions?
I am working on a project using the Laravel 4.2 framework. I want to execute the command php artisan migrate but when I run this command it shows an error:
[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1142 CREATE command denied to user 'abc'#'10.1.1.27' for table 'migrations'
I think I have placed the project files and the database on different servers, so that's why am I getting this error.
Database server: 10.1.1.56
Project server: 10.1.1.27 (localhost)
This error indicates that the remote MySQL database isn't configured to allow certain operations executed by the user abc from the IP address 10.1.1.27. In many cases, MySQL users are set up to allow access from the the same host as the database server, but we need to explicitly GRANT access for clients connecting to the database from a remote host.
We can use the following commands to grant the user abc access from remote hosts. We must run these commands as a user that has the ability to grant privileges to other users (such as the database's root user):
GRANT ALL PRIVILEGES ON database.* TO 'abc'#'%';
FLUSH PRIVILEGES;
Replace database with the name of the application's database configured in .env or config/database.php. The wildcard '%' in 'username'#'%' indicates that we want to give permissions to that user from any IP address. If we don't want to allow the user access from any IP address, we can limit access to specific IP addresses by replacing the wildcard with the address to allow (10.1.1.27 in this case).
Depending on the needs of the project, we may not need to give a user all privileges to a database. See the documentation for a list of available privileges that we can assign.
1142 CREATE command denied to user 'abc'#'10.1.1.27' for table 'migrations'
The above command simply means that the user don't have CREATE permission on the connected database. So first of all you have to grant the privileges to that user on the database and after that run the migration.
Explanation: When you run migrate, a table is created on with the name migration in the database that maintains the status of migration ion it, and you don'r have the CREATE permission that's why it is showing error.
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.
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'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';