MySQL is throwing a syntax error when I try creating a new user, where is the issue?

Hello,

Last year I successfully set up Linode, Apache, MYSQL, and Wordpress with no problems.

Now I'm doing it again with a new site and I'm having issues with MYSQL. I'm running Ubuntu 14.04 LTS

In brief, I am having an issue creating a MYSQL user and password and then granting it permissions.

After I create MYSQL and put this line in:

grant all on exampleDB.* to 'example_user' identified by 'password';

(Obviously changing bolded to what I want it to be)

I get this in return:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'grant all on exampleDB.* to ‘exampleuser’ identified by ‘exampleuser’' at line 1

mysql>

Outside of installing and configuring and editing / adding the following values:

maxallowedpacket = 1M

thread_stack = 128K

max_connections = 75

tableopencache = 32M

keybuffersize = 32M

I have yet to do anything for there to be an error (I think). What should I do to fix this error and move forward?

3 Replies

CREATE DATABASE exampleDB; CREATE USER 'example_user'@'localhost' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON exampleDB.* TO 'example_user'@'localhost';

@sleddog:

CREATE DATABASE exampleDB;
CREATE USER 'example_user'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON exampleDB.* TO 'example_user'@'localhost';

Thanks!

So I tried this before and got a similar error. Just tried it again and when i try to grant all privileges I get this error:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' IDENTIFIED BY ‘password’;

This error only appears after I try to grant all privileges.

All of your error messages have slanted quote characters in them. Perhaps that's the reason you're getting syntax errors. Are you using any program that automatically converts 'straight' "quotes" into ‘curly’ “quotes”, or copying and pasting from a website that uses curly quotes?

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct