Forums

ERROR 1142 (42000): CREATE command denied to user 'stevenpj'@'10.0.0.144' for table 'what'

RESOLVED:

Hi - I'm building a new site and trying to test creating a database and getting this error. I went and created a new DB in the web GUI called test and am just trying to create one table as a test, but getting this error.

my script that I used to create a local DB that worked is as follows:


-- Table test.what


CREATE TABLE IF NOT EXISTS test.what ( idwhat INT NOT NULL AUTO_INCREMENT, name VARCHAR(45) NULL, PRIMARY KEY (idwhat)) ENGINE = InnoDB;

SET SQL_MODE=@OLD_SQL_MODE; SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS; SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS;

Any idea?

Do you have the database name in the SQL command that you're running, like you do in your example? If you do, then you'll need to use the quoted database name on PythonAnywhere -- for example, instead of

CREATE TABLE IF NOT EXISTS test.what ...

...you would need to use something like

CREATE TABLE IF NOT EXISTS `stevenpj$yourdbname`.what ...

...where yourdbname is the database name that you provided when creating the database from the web UI.