MySQL数据库插入问题

来源:百度知道 编辑:UC知道 时间:2024/09/23 23:39:27
第一个数据库create_database.sql里面内容为:
create database mail;

use mail;

create table users
(
username char(16) not null primary key,
password char(40) not null,
address char(100) not null,
displayname char(100) not null
);

create table accounts
(
username char(16) not null,
server char(100) not null,
port int not null,
type char(4) not null,
remoteuser char(50) not null,
remotepassword char(50) not null,
accountid int unsigned not null auto_increment primary key
);

grant select, insert, update, delete
on mail.*
to mail@localhost identified by 'password';
第二个数据库populate.sql里面内容为:
use mail;

insert into users values
('user', sha1('password'), 'email@host.domain', 'Full Name');

insert into accounts values
('user', 'localhost', '110', '

是不是少了一个参数accountid?

我觉得你是想用accountid来做主键,你应该把它设为自增,否则就必须人工指定。如:
insert into accounts values
('1','user', 'localhost', '110', 'POP3', 'user', 'password', '')

补充:
能一次插入2个吗,好像没有这样的语法。至少不是这样的语法。