Search code examples
mysqlsyntax

syntax error on import mysql


this is my sql i want to use in my database but i have a problem with that:

-- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Dec 27, 2012 at 07:12 PM
-- Server version: 5.5.19
-- PHP Version: 5.3.8

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Database: `lol`
--

-- --------------------------------------------------------

--
-- Table structure for table `users`
--

  CREATE TABLE IF NOT EXISTS `users` (
 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `username` varchar(48) CHARACTER SET utf8 NOT NULL,
 `password` varchar(48) CHARACTER SET utf8 NOT NULL,
 `email` varchar(255) CHARACTER SET utf8 NOT NULL,
 `sid` varchar(32) NOT NULL,
 PRIMARY KEY (`id`)
 ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1020 ;

--
-- Dumping data for table `users`
--

INSERT INTO `users` (`id`, `username`, `password`, `email`, `sid`) VALUES
(1001, 'Larry', 'md5passhere', ' @', ''),

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

when i want to import that into database i have this error:

#1064 - 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 'SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */' at line 8 

i don't know how to fix that with search on web i cannot find useful thing about my problem so you think how i can resolve that problem?


Solution

  • At the end of you INSERT INTO users you have a , Which does not belong there, and also you might want to remove the other ; after the /* */;?

    Update

    -- phpMyAdmin SQL Dump
    -- version 3.5.1
    -- http://www.phpmyadmin.net
    --
    -- Host: localhost
    -- Generation Time: Dec 27, 2012 at 07:12 PM
    -- Server version: 5.5.19
    -- PHP Version: 5.3.8
    
    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
    SET time_zone = "+00:00";
    
    
    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT; */
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS; */
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION; */
    /*!40101 SET NAMES utf8 */;
    
    --
    -- Database: `lol`
    --
    
    -- --------------------------------------------------------
    
    --
    -- Table structure for table `users`
    --
    
      CREATE TABLE IF NOT EXISTS `users` (
     `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
     `username` varchar(48) CHARACTER SET utf8 NOT NULL,
     `password` varchar(48) CHARACTER SET utf8 NOT NULL,
     `email` varchar(255) CHARACTER SET utf8 NOT NULL,
     `sid` varchar(32) NOT NULL,
     PRIMARY KEY (`id`)
     ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1020 ;
    
    --
    -- Dumping data for table `users`
    --
    
    INSERT INTO `users` (`id`, `username`, `password`, `email`, `sid`) VALUES
    (1001, 'Larry', 'md5passhere', ' @', '');
    
    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT; */
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS; */
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION; */