Mysql Create Database Syntax Error
Contents |
Search HCL Search Reviews Search ISOs Go to Page... LinuxQuestions.org > Forums > Linux Forums > Linux - Server [SOLVED] mysql error while creating database User Name Remember Me? Password Linux - error 1064 mysql 42000 create table Server This forum is for the discussion of Linux Software used in a
Error 1064 Mysql 42000 Create User
server related context. Notices Welcome to LinuxQuestions.org, a friendly and active Linux Community. You are currently viewing LQ as a error 1064 (42000): you have an error in your sql syntax; guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple
Access Denied For User ''@'localhost' To Database
and absolutely free. Join our community today! Note that registered members see fewer ads, and ContentLink is completely disabled once you log in. Are you new to LinuxQuestions.org? Visit the following links: Site Howto | Site FAQ | Sitemap | Register Now If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here. mysql error 1064 Having a problem logging in? Please visit this page to clear all LQ-related cookies. Introduction to Linux - A Hands on Guide This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter. For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own. Click Here to receive this Complete Guide absolutely free. Search this Thread 07-28-2011, 08:37 AM #1 ramecare Member Registered: Feb 2011 Posts: 179 Rep: mysql error while creating database Dear all, While creating a new database iam facing the below problem,i searched in google to solve but i was not able to solve,can any one help me on this. mysql> create database auto-download-gta; ERROR 1064 (42000):
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company
Mysql Version
Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs
Mysql Workbench
Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, mysql create user just like you, helping each other. Join them; it only takes a minute: Sign up ERROR 1064 (42000): You have an error in your SQL syntax; up vote 1 down vote favorite 1 I have a MySQL http://www.linuxquestions.org/questions/linux-server-73/mysql-error-while-creating-database-894292/ commands: CREATE DATABASE IF NOT EXISTS courses; USE courses CREATE TABLE IF NOT EXISTS teachers( id INT(10) UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT, name VAR_CHAR(50) NOT NULL, addr VAR_CHAR(255) NOT NULL, phone INT NOT NULL, ); When I run it, I get an 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 'VAR_CHAR(50) NOT NULL, http://stackoverflow.com/questions/18742492/error-1064-42000-you-have-an-error-in-your-sql-syntax addr VAR_CHAR(255) NOT NULL, phone INT NOT NULL, )' at line 3 mysql sql share|improve this question edited Mar 5 '15 at 21:58 Adrian Cid Almaguer 6,922122349 asked Sep 11 '13 at 13:24 SkyStar 28129 it's VARCHAR not VAR_CHAR! –John Woo Sep 11 '13 at 13:26 Thank you! Just a simple error ) –SkyStar Sep 11 '13 at 13:27 add a comment| 3 Answers 3 active oldest votes up vote 8 down vote accepted It is varchar and not var_char CREATE DATABASE IF NOT EXISTS courses; USE courses; CREATE TABLE IF NOT EXISTS teachers( id INT(10) UNSIGNED PRIMARY KEY NOT NULL AUTO_INCREMENT, name VARCHAR(50) NOT NULL, addr VARCHAR(255) NOT NULL, phone INT NOT NULL ); You should use a SQL tool to visualize possbile errors like MySQL Workbench. share|improve this answer edited Sep 11 '13 at 13:31 answered Sep 11 '13 at 13:26 juergen d 126k21133198 Won't work, look at phone, you got extra comma there. –N.B. Sep 11 '13 at 13:27 1 What is wrong with "use databasename"? –Borniet Sep 11 '13 at 13:30 add a comment| up vote 1 down vote Try this: Use back-ticks for NAME CREATE TABLE `teachers` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, `addr` varchar(255) NOT NULL, `phone` int(10) NOT NULL, PRIMARY KEY (`id
log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn http://dba.stackexchange.com/questions/90619/cannot-create-mysql-database-with-name-5e370227-db more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Database Administrators Questions Tags Users Badges Unanswered Ask Question _ Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute: Sign up Here's how it works: Anybody can error 1064 ask a question Anybody can answer The best answers are voted up and rise to the top Cannot create MySQL database with name '5e370227_db' up vote 0 down vote favorite Why am I getting error when I try to create database with name '5e370227_db'? I am getting the following error: mysql> create database 5e370227_db; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that error 1064 mysql corresponds to your MySQL server version for the right syntax to use near '5e370227_db' at line 1 When I try to create a database with name '5a370227_db' (e -> a) it is created successfully: mysql> create database 5a370227_db; Query OK, 1 row affected (0.00 sec) Details: MYSQL: mysql Ver 14.14 Distrib 5.1.73, for redhat-linux-gnu (x86_64) using readline 5.1 Linux Centos 2.6.32-358.el6.x86_64 logged as root database admin mysql share|improve this question edited Jan 30 '15 at 12:43 asked Jan 30 '15 at 8:58 Felix 1033 1 A SQL identifier is not allowed to start with a number. You must quote the name: "5e370227_db" or using MySQL's dreaded backticks: `5e370227_db` –a_horse_with_no_name Jan 30 '15 at 12:55 add a comment| 1 Answer 1 active oldest votes up vote 2 down vote accepted Interesting problem and I think that I've figured it out. For some reason, MySQL interprets 1e_a_number_ as an exponent - i.e. 10 to the power of something. 1a_a_number has no mathematical meaning, therefore it's not parsed as being a number and accepted as valid. If you notice at the beginning of my experiments below - pure numbers aren't allowed as database/schema names. Congratulations - it looks like you've spotted a MySQL bug. Something like this (unde