1

I have a redhat linux in AWS EC2. I created a few dbs yesterday for an application. Today, I am getting an error in creating a new database.

mysql -u root -p
pw: xxx

CREATE testdb; 

I get an error 1064(42000): You have an error in SQL syntex; check the manual that corresponds to your mysql server version for the right syntex to use near 'testdb' at line 1.

I also tried mysqladmin -u root -p$pwd create testdb;

It takes the password and throws the same problem.

Root has all permissions.

mysql

1
  • 1
    You probably mean CREATE DATABASE testdb;. Note that your question isn't really on-topic for this site, and you made a number of errors pasting the exact error message. Feb 19, 2016 at 19:14

2 Answers 2

1

The correct syntax is CREATE DATABASE dbname.

6
  • Sorry for posting it here. It does not make a difference. I also tried CREATE DATABASE testdb; it throws the same error.
    – mysqlnew
    Feb 19, 2016 at 19:28
  • @mysqlnew Can you update your screenshot with one you log in with root in the interactive mode and run CREATE DATABASE testdb? Now your screenshot shows different error numbers for your two commands, and the second error number is not found anywhere
    – bfrguci
    Feb 19, 2016 at 19:36
  • Thanks. Same outcome. the error is 1006 (HY000) (errno: 15519024).
    – mysqlnew
    Feb 19, 2016 at 19:49
  • Please have a look at questions related to that 1006 error, for example, stackoverflow.com/questions/18719748/…; stackoverflow.com/questions/19120771/…; quora.com/…
    – bfrguci
    Feb 19, 2016 at 19:51
  • It sounds like it is related to a file system problem.
    – bfrguci
    Feb 19, 2016 at 19:52
-1

@bfrguci: Thanks for the links again. The problem was with permissions. Although I edited my.cnf to address the change of datadir, the .sock folder did not change. Mysql was unable to write to the new data dir.

sudo chown -R mysql:mysql /new_dir/data/; worked for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .