Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near

I ran this command :

CREATE DATABASE wordpress;

And I got

Query OK, 1 row affected (0.00 sec)

I ran the second command :

CREATE USER wordpressuser@localhost IDENTIFIED BY ‘password’;

And I got:

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 '‘password’' at line 1

What am I doing wrong? Running a freshly installed Ubuntu 14.04 Server and trying to make a database for Wordpress.

like image 480
user2950680 Avatar asked Apr 14 '16 18:04

user2950680


People also ask

How do I fix error 1064 42000 in MySQL?

The ERROR 1064 (42000) mainly occurs when the syntax isn't set correctly i.e. error in applying the backtick symbol or while creating a database without them can also create an error, if you will use hyphen in the name, for example, Demo-Table will result in ERROR 1064 (42000). Now database is created successfully.

What is MySQL w3schools?

MySQL is a widely used relational database management system (RDBMS). MySQL is free and open-source. MySQL is ideal for both small and large applications. Start learning MySQL now »


2 Answers

Try this:

CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';

Remember the quote in used is not around the @ symbol, and it is not ‘ ’ but ' '. And the first thing to do is to provide the user with access to the information this wordpressuser will need.

GRANT ALL PRIVILEGES ON * . * TO 'wordpressuser'@'localhost';

The asterisks in this command refer to the database and table (respectively) that they can access—this specific command allows to the user to read, edit, execute and perform all tasks across all the databases and tables.

Once you have finalized the permissions that you want to set up for your new wordpressuser, always be sure to reload all the privileges.

FLUSH PRIVILEGES;
like image 140
Mawia HL Avatar answered Sep 19 '22 11:09

Mawia HL


Try the below query

CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
like image 29
DhruvJoshi Avatar answered Sep 22 '22 11:09

DhruvJoshi