8

这是我想在我的数据库中使用的 sql,但我有一个问题:

-- 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 */;

当我想将其导入数据库时​​,出现此错误:

#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 

我不知道如何通过网络搜索来解决这个问题,我找不到关于我的问题的有用信息,所以你认为我该如何解决这个问题?

4

2 回答 2

8

在你的最后INSERT INTO users你有一个,不属于那里的,你也可能想在?;之后删除另一个。/* */;

更新

-- 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; */
于 2013-05-08T20:55:28.830 回答
1

删除 SQL 脚本的注释部分,特别是“;”

于 2013-05-08T20:56:08.283 回答