mysql命令大全
启动:net start mySql;
进入:mysql -u root -p/mysql -h localhost -u root -p databaseName;
列出数据库:show databases;
选择数据库:use databaseName;
列出表格:show tables;
显示表格列的属性:show columns from tableName;
建立数据库:source fileName.txt;
匹配字符:可以用通配符_代表任何一个字符,%代表任何字符串;
增加一个字段:alter table tabelName add column fieldName dateType;
增加多个字段:alter table tabelName add column fieldName1 dateType,add columns fieldName2 dateType;
多行命令输入:注意不能将单词断开;当插入或更改数据时,不能将字段的字符串展开到多行里,否则硬回车将被储存到数据中;
增加一个管理员帐户:grant all on *.* to user@localhost identified by "password";
每条语句输入完毕后要在末尾填加分号';',或者填加'\g'也可以;
查询时间:select now();
查询当前用户:select user();
查询数据库版本:select version();
查询当前使用的数据库:select database();
1、删除student_course数据库中的students数据表:
rm -f student_course/students.*
2、备份数据库:(将数据库test备份)
mysqldump -u root -p test>c:\test.txt
备份表格:(备份test数据库下的mytable表格)
mysqldump -u root -p test mytable>c:\test.txt
将备份数据导入到数据库:(导回test数据库)
mysql -u root -p test
3、创建临时表:(建立临时表zengchao)
create temporary table zengchao(name varchar(10));
4、创建表是先判断表是否存在
create table if not exists students(……);
5、从已经有的表中复制表的结构
create table table2 select * from table1 where 1<>1;
6、复制表
create table table2 select * from table1;
7、对表重新命名
alter table table1 rename as table2;
8、修改列的类型
alter table table1 modify id int unsigned;//修改列id的类型为int unsigned
alter table table1 change id sid int unsigned;//修改列id的名字为sid,而且把属性修改为int unsigned
相关文档:
QT DataBase SQL Explorer
1、安装MySQL到官方网站下载MySQL数据库,非安装版,直接运行mysqld进程前台的
2、添加系统环境变量,Path+=':\mysql\bin'的path,再在开始运行,CMD->mysql -uroot 登录到mySQL数据库
Default password没有的,有的话 mysql -uroot -p输入密码;网络登录:mysql -h ip ......
1.show status
Threads_connected 当前的连接数
Connections 试图连接到(不管是否成功)MySQL服务器的连接数。
Max_used_connections 服务器启动后已经同时使用的连接的最大数量。
2.set GLOBAL max_connections=连接数;
flush privilege ......
《mysql 与 php 基础教程》
1. 文本函数
函数
用法
用途
CONCAT()
CONCAT(x,y,...)
创建形如xy的新字符串
CONCAT_WS()
CONCAT_WS(separator,column1,column2,...)
分隔符将插入所列出的每个列之间
LENGTH()
LENGTH(column)
返回列中存储的字符串的长度
LEFT()
LEFT(colum,x)
从列的值中返回最左边的x ......
#!/usr/bin/env python
# -*-coding:UTF-8-*-#这一句告诉python用UTF-8编码
#=========================================================================
#
# NAME: Python MySQL test
#
# AUTHOR: benyur
# DATE : 2004-12-28
#
# COMMENT: 这是一个python连接mysql的例子
#
#================ ......
安装apache + mysql + discuz +php
apache http://www.apache.org/
mysql http://dev.mysql.com/downloads/
MySQL GUI Tools http://dev.mysql.com/downloads/gui-tools/5.0.html
php &n ......