Why am I getting this MySQL database creation error?

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

mysqlnew

Posted 2016-02-19T19:09:51.710

Reputation: 9

1You 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. – ChrisInEdmonton – 2016-02-19T19:14:58.050

Answers

1

The correct syntax is CREATE DATABASE dbname.

bfrguci

Posted 2016-02-19T19:09:51.710

Reputation: 403

Sorry for posting it here. It does not make a difference. I also tried CREATE DATABASE testdb; it throws the same error. – mysqlnew – 2016-02-19T19:28:30.930

@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 – 2016-02-19T19:36:37.127

Thanks. Same outcome. the error is 1006 (HY000) (errno: 15519024). – mysqlnew – 2016-02-19T19:49:00.363

It sounds like it is related to a file system problem. – bfrguci – 2016-02-19T19:52:28.657

thanks. I will read the links and post. In the mean time, I did change the data dir from the default path. I have made changes towards that effect in mycnf... However, I wonder, if the permission is still denied to the .sock in the default path. I tried changing the permission by using chown -r mysql:mysql /.../. Change ownership operation was not permitted. I will investigate the url and post. thanks again – mysqlnew – 2016-02-19T20:54:45.710

-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.

mysqlnew

Posted 2016-02-19T19:09:51.710

Reputation: 9