MySQL常用

写于2011年,mysql5.1

1、导入导出

  select * from f_pc_user_cndt_20101128 into outfile 'd:/f.txt' Fields Terminated By ',' Lines Terminated By '\n'
     LOAD DATA local INFILE 'd:/f.txt' IGNORE into table f_pc_user_cndt_20101128 Fields Terminated By ',' Lines Terminated By '\n';

2、启动

     /etc/init.d/mysqld-ib restart
     /usr/local/infobright/bin/mysqld_safe --defaults-file=/etc/my.cnf --user=mysql &

3、执行文件

  mysql -uroot -ppassword fdp < fdp.sql

4、登录

     /usr/local/mysql/bin/mysql -uroot -p123456
     mysql -uroot -h127.0.0.1 -pemaradmin

5、创建用户

create database cuixz;
GRANT ALL ON *.* TO cuixz@'%' IDENTIFIED BY 'cuixz'

6、查所有表

select trim(table_name), trim(table_comment), table_schema from information_schema.tables where table_schema in {0} order by table_schema, table_name

7、查表的列

select trim(column_name), trim(column_comment), column_type, case when left(column_key,1) = 'P' then 'Y' end, is_nullable from information_schema.columns where table_schema ='{0}' and table_name = '{1}' order by ordinal_position

8、查看变量:

SHOW VARIABLES LIKE 'character%'
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值