MySQL相关

[my.cnf]

  [mysqld]

  character-set-server  = utf8

  init_connect      = 'SET NAMES utf8'

  bind-address       = 具体IP列表或注释掉此条

 

在Ubuntu下

sudo apt-get install mysql-server

sudo service mysql start|restart|stop

如果无法启动,重新修改my.cnf

 

[sql 脚本]

drop database if exists mydb;

create database mydb character set 'utf8' collate 'utf8_general_ci';

 

revoke all on mydb.* from 'myname'@'localhost';

drop user 'myname'@'localhost';

create user 'myname'@'localhost' identified by 'mypasswd';

grant select, insert, update, delete on mydb.* to 'myname'@'localhost';

grant all on mydb.* to 'another'@'%'

 

use mydb;

drop table if exists t_mytable;

create table t_mytable (

  n_key  bigint  auto_increment  primary key,

  s_value  varchar(32)  not null

) engine=innodb default charset=utf8;

alert table t_mytable add constraint mytable_pks primary key(.., .., ...);

posted on 2013-02-05 11:17  kevin灬  阅读(112)  评论(0)    收藏  举报

导航