Getting HTTP error 500 even if the account is authorised - html

Having an issue with the database enabling on my cpanel.
I am using A2Hosting.
As I create the tables I get this error when I go to a page that uses it:
To try and fix this I added privileges to my account
here is my database code:
<?php
class config_db {
public function init() {
PDO('mysql:host=localhost;dbname="DATABASENAME";charset=utf8', '"USERNAME"', '"PASSWORD"');
return $db;
}
}
?>
After adding privileges I get this error:
Not sure why I still get an HTTP ERROR 500 after I have granted privileges
UPDATE:
As I checked one solution is to delete the plugins, but my cpanel files has none of it
UPDATE:
Creating a username and password that the database uses uniquely does not work either
UPDATE:
Deleting the .htaccess folder gets me a 404 not found problem
UPDATE:
There are no errors shown using inspect element or event in the cpanel
UPDATE:
The database is connected succesfully as I checked but the error 500 still persists

In A2Hosting please make sure you are using the correct database name. As per the documentation it should be:
When you create a database, your username is prefixed to the database name.
For example, if your username is abc, and you create a database named db, the actual MySQL database name is abc_db.
For more information:
https://www.a2hosting.com/kb/cpanel/cpanel-database-features/managing-mysql-databases

Related

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.

Jawsdb on heroku, new database post migration, (Mysql2::Error: INSERT command denied to user..?)

Deployed a new version of our app on heroku and migrated over database from previous free jawsdb instance. However now every time user signs up gives
(Mysql2::Error: INSERT command denied to user <username for instance
what have i missed
migrated using a dump and re-import using mysql command line. eye balled exported data and it seems to be there (user emails etc)
all config vars look ok (DATABASE_URL is mysql2...)
i can login to the database via the url
I have not had to grant access or anything like that before, anyone come across this?
thanks
Ben
My guess is they disabled your INSERT grant because you have reached your max Storage Capacity for your plan.
To validate this is a permissions problem, log into a MySQL prompt with the user the app is running as, and enter this query:
SHOW GRANTS;
It probably list many, but no INSERT.
See this link. As explained in given link, jawsdb preliminary plan does not give you permission to add a new database. You are provided with one schema with some random name and you have to work with that only.
Check your migration
e.g. Make sure the database name matches.
For me, I got the same error as OP when trying to migrate my data. This was a fresh account with only a 50kb'ish database; nowhere close to the free-plan 5mb limit.
In my SQL export statement, my local database name is being used, however the remote MySQL (ie JawsDB) service auto-generates a db name, which will obviously not be the same. Simply used find-replace to change the database name to match remote; everything works.

MySQL 403 forbidden error

I'm attempting to delete certain data from a table and this is what happens...
Error in processing the request.
I have no idea about what may be the cause.
I've reuploaded the whole phpmyadmin .zip to my site
I've created a clone database and added the same user to it
I've added all privileges to the user that manages the database
I've created a new user with all privileges to manage the database
None worked... The strange thing is that when I access the database from Cpanel I can do everything normally, this issue only happens when I access from my site.
Image with error:

Migrating Wordpress database to server SQL error

I have just finished a Wordpress site and I'm trying to set it up on the server. I did the following, as always:
uploaded a .htaccess file to a public_html folder with the text from https://codex.wordpress.org/htaccess (basic WP)
moved all the contents from the local wordpress folder to public_html
exported my local database and changed all instances of 'localhost/siteName/wordpress' with 'www.siteAddress.com'
created a mySQL database in cPanel's mySQL section
created a new user in cPanel's mySQL section
changed the wp_config file so that db_name, db_user and db_password values mach the prefix_name, prefix_username and user password of the newly created db/user
added that user to the database with all privileges granted
TRIED to import the exported local database to server via cPanel's phpMyadmin section. That's where I got this error:
1044 - Access denied for user 'something'#'localhost' to database 'else'
Of course, 'something' and 'else' are not the real values... Can anyone tell me if I did something wrong, or I didn't do something else at all? I never had this problem before? The differences are that the Wordpress itself got updated in the meantime and I worked with WooCommerce for the first time... if it matters, though I suspect it doesn't.
Thanks in advance, I know it's a bit of reading :)
[EDIT]: I tried the same procedure again (third time in a row), and it worked... so, the solution would be - the question itself.
Take a look at this dzenesiz and see if this helps.
http://www.inmotionhosting.com/support/website/database-troubleshooting/mysql-1044-access-denied-error-message

Cannot connect to Google Cloud SQL using a not root account from GAE

I'm having a problem with trying to stablish a database connection with an user that's not root. I mean I have defined the following user at my database.
dev#host
I try to connect the way indicated here: https://developers.google.com/appengine/docs/java/cloud-sql/, but I get a truly strange error, I've set the application to display what error is the one that doesn't allow to connect with that user and I get this:
java.sql.SQLException:Access denied for user 'dev#host'#'localhost'.
I wonder where it can get that localhost from... I've also tried to change the name of the user to dev'#'host but it keeps on the localhost issue.
If I connect with root, not inputting any user or password it connects properly, but I need the application to be connected by users with less privileges.
Any idea what I can be doing wrong?
Thanks for your help.
Check this page…you need to set up permissions…
https://developers.google.com/cloud-sql/docs/access-control?hl=pt
Are you using a mySql client? Did you manage to add an authorized IP address?
Cheers.