mysql syntax error 1064 (42000)

Miha Šušteršič

I have a standard LAMP configuration (apache2, mysql, php5), running on ubuntu, and I'm just typing mysql commands into my terminal. I'm logged into the mysql command line as root. So far I've created a new database, but now trouble started.

I'm trying to create a simple table but am getting a mysql syntax error and can't figure out what I'm doing wrong.

This is the 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 ')' at line 10

And this is my query:

CREATE TABLE IF NOT EXISTS `customers` (
  `uid` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `name` varchar(50) NOT NULL,
  `email` varchar(50) NOT NULL,
  `phone` varchar(100) NOT NULL,
  `password` varchar(200) NOT NULL,
  `address` varchar(50) NOT NULL,
  `city` varchar(50) NOT NULL,
  `created` datetime NOT NULL DEFAULT TIMESTAMP
);

No idea what's wrong honestly.

Abhik Chakraborty

You can assign default value as current_timestamp not just timestamp

CREATE TABLE IF NOT EXISTS `customers` (
  `uid` int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
  `name` varchar(50) NOT NULL,
  `email` varchar(50) NOT NULL,
  `phone` varchar(100) NOT NULL,
  `password` varchar(200) NOT NULL,
  `address` varchar(50) NOT NULL,
  `city` varchar(50) NOT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP
);

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

SQLSTATE[42000]: Syntax error or access violation: 1064 PHP/MySQL

From Dev

MySQL Dump Error 1064 (42000)

From Dev

MySQL: ERROR 1064 (42000) on trigger

From Dev

MySQL Syntax error SQL Error [1064] [42000]: You have an error in your SQL syntax

From Dev

SQLSTATE[42000]: Syntax error or access violation: 1064

From Dev

ERROR 1064 (42000): SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ');

From Dev

Syntax Error MYSQL 1064

From Dev

MySQL: 1064 Syntax Error

From Dev

MySQL: 1064 Syntax Error

From Dev

Mysql syntax error, 1064

From Dev

mysql ERROR 1064 (42000): You have an error in your SQL syntax; check the manual

From Dev

ERROR 1064 (42000): check the manual that corresponds to your MySQL server version for the right syntax to use near 'END'

From Dev

MySQL Error 1064 (42000) Script Insert

From Dev

MySQL Error 1064 (42000) Script Insert

From Dev

ERROR 1064 (42000) creating table in mysql

From Dev

UDF trigger not working MySQL ERROR 1064 (42000)

From Dev

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

From Dev

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?

From Dev

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

From Dev

MySQl Error #1064 Syntax error

From Dev

ERROR 1064 (42000): You have an error in your SQL syntax;

From Dev

ERROR 1064 (42000): You have an error in your SQL syntax

From Dev

ERROR 1064 (42000) at line 4822: error in SQL syntax;

From Dev

DB:SQLSTATE[42000]: Syntax error or access violation: 1064 Error

From Dev

CakePHP 3 Error: SQLSTATE[42000]: Syntax error or access violation: 1064

From Dev

PDOException SQLSTATE[42000]: Syntax error or access violation: 1064

From Dev

Doctrine2 SQLSTATE[42000]: Syntax error or access violation: 1064

From Dev

Failed to run query: SQLSTATE[42000]: Syntax error or access violation: 1064

From Dev

SQLSTATE[42000]: Syntax error or access violation: 1064 Symfony 2.7.3 application

Related Related

  1. 1

    SQLSTATE[42000]: Syntax error or access violation: 1064 PHP/MySQL

  2. 2

    MySQL Dump Error 1064 (42000)

  3. 3

    MySQL: ERROR 1064 (42000) on trigger

  4. 4

    MySQL Syntax error SQL Error [1064] [42000]: You have an error in your SQL syntax

  5. 5

    SQLSTATE[42000]: Syntax error or access violation: 1064

  6. 6

    ERROR 1064 (42000): SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ');

  7. 7

    Syntax Error MYSQL 1064

  8. 8

    MySQL: 1064 Syntax Error

  9. 9

    MySQL: 1064 Syntax Error

  10. 10

    Mysql syntax error, 1064

  11. 11

    mysql ERROR 1064 (42000): You have an error in your SQL syntax; check the manual

  12. 12

    ERROR 1064 (42000): check the manual that corresponds to your MySQL server version for the right syntax to use near 'END'

  13. 13

    MySQL Error 1064 (42000) Script Insert

  14. 14

    MySQL Error 1064 (42000) Script Insert

  15. 15

    ERROR 1064 (42000) creating table in mysql

  16. 16

    UDF trigger not working MySQL ERROR 1064 (42000)

  17. 17

    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

  18. 18

    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?

  19. 19

    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

  20. 20

    MySQl Error #1064 Syntax error

  21. 21

    ERROR 1064 (42000): You have an error in your SQL syntax;

  22. 22

    ERROR 1064 (42000): You have an error in your SQL syntax

  23. 23

    ERROR 1064 (42000) at line 4822: error in SQL syntax;

  24. 24

    DB:SQLSTATE[42000]: Syntax error or access violation: 1064 Error

  25. 25

    CakePHP 3 Error: SQLSTATE[42000]: Syntax error or access violation: 1064

  26. 26

    PDOException SQLSTATE[42000]: Syntax error or access violation: 1064

  27. 27

    Doctrine2 SQLSTATE[42000]: Syntax error or access violation: 1064

  28. 28

    Failed to run query: SQLSTATE[42000]: Syntax error or access violation: 1064

  29. 29

    SQLSTATE[42000]: Syntax error or access violation: 1064 Symfony 2.7.3 application

HotTag

Archive