易截截图软件、单文件、免安装、纯绿色、仅160KB

【转】常用mysql操作命令

   
Administration 管理
Kill a Thread  结束一个线程
mysql > KILL 999;
 
Optimize Table 优化表
mysql > OPTIMEZE TABLE foo;
 
Reload Users Permissions 刷新MySQL系统权限相关表  
mysql > FLUSH PRIVILEGES;
 
Repair Table 修复表
mysql > REPAIR TABLE foo;
 
Reset the Query Cache 清除查询缓存区中的所有的内容
mysql > RESET QUERY CACHE;
 
See Which Threads are Running 显示哪些线程正在运行
mysql > SHOW FULL PROCESSLIST;
 
 
Backup & Restore
Backup Database to a SQL File 备份数据库
#mysqldump --user admin -- password=password mydatabase > database.sql
 
Restore Database from SQL File 还原数据库
#mysql < database.sql
 
Data Definition 数据库描述
Add a Column to a Table
mysql > ALTER TABLE table1 ADD COLUMN newcol TEXT;
 
Browse Database
mysql > USE dbname;
mysql > SHOW TABLES;
 
Create Database
mysql > CREATE DATABASE dbname;
 
Create Table
mysql > CREATE TABLE table (field1 type1, field2 type2, ...)
 
Drop Database
mysql > DROP DATABASE dbanme;
 
Remove a Column from a table
mysql > ALTER TABLE table1 DROP COLUMN oldcol;
 
Rename a Table
mysql > ALTER TABLE table1 RENAME TO newtable2;
 
Data Manipulation 数据操作
Delete Row from Table
mysql > DELETE from table1 WHERE id = 100;
 
Insert Row to Table
mysql > INSERT INTO table1(field1, field2, ...) VALUES(value1,value2,...);
 
Update Row in Table
mysql > UPDATE table1 SET field1 = new_value1 WHERE id = 100;
 
Emergency Maintenance 常规操作
Find the error log
#tail -f /var/lib/mysqlserver.domain.co.il.err
 
Recover root Password
Stop MySQL service
#/etc/init.d/mysql stop
 
Start to MySQL server w/o password
#mysqld_safe --skip-grant-tables &
 
Connect to mysql
#mysql -u root
 
Setup new MySQL root user password
mysql > use mysql;
mysql > upda


相关文档:

mysql备份恢复

要備份 MySQL 資料庫主要分為兩個方法,一是將資料庫目錄完整備份:二是使用 MySQL 內建的 mysqldump 程式。
備份資料庫目錄
MySQL 預設的儲存目錄在 /var/lib/mysql 內容,底下會 ......

MySQL Cluster Overview


MySQL Cluster
is a technology that enables
clustering of in-memory databases in a shared-nothing system. The
shared-nothing architecture allows the system to work with very
inexpensive hardware, and with a minimum of specific requirements
for hardware or software.

......

MySQL Cluster Multi Computer How To


This section is a “How-To
” that describes the basics
for how to plan, install, configure, and run a MySQL Cluster.
Whereas the examples in
Chapter 3, MySQL Cluster Configuration
provide more in-depth
information on a variety of clustering options and co ......

MYSQL数据库优化摘录

1、选取最适用的字段属性
  MySQL可以很好的支持大数据量的存取,但是一般说来,数据库中的表越小,在它上面执行的查询也就会越快。因此,在创建表的时候,为了获得更好的性能,我们可以将表中字段的宽度设得尽可能小。例如,在定义邮政编码这个字段时,如果将其设置为CHAR(255),显然给数据库增加了不必要的空间,甚至使 ......

Quick Test Setup of MySQL Cluster


To familiarize you with the basics, we will describe the simplest
possible configuration for a functional MySQL Cluster. After this,
you should be able to design your desired setup from the
information provided in the other relevant sections of this
chapter.
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号