mysql基本用法
http://dev.mysql.com/doc/refman/5.1/zh/index.html
(MySql 5.1 中文参考手册)
*------------------------------------------------------------------------------------------
show databases; 显示数据库
drop database 数据库名;删除数据库
set names 'utf8';设置数据库编码为utf-8
source x:\数据库名.sql;导入一个数据库
USE 数据库名;尝试存取数据库
CREATE DATABASE 数据库名;创建一个数据库
*---------------------------------------------------------------------------------------------
为表增加索引:alter table 表名 add index 索引名 ('字段名');
为表增加外键: (例表A的uid是外键,对应表B的id) (表类型为InnoDB才有外键约束)
alter table A add foreign key (uid) references B (id) on delete restrict on update restrict;
*--------------------------------------------------------------------------------------------
Mysql的导入和导出
mysqldump -u root -pYOURPASSWORD DATA_BASE_NAME >mydatabasebak.sql
::是把 数据库 DATA_BASE_NAME 备份到文本文件 mydatabasebak.sql
scp mydatabasebak.sql username@192.168.0.114:.
输入用户username 的密码.
ssh 192.168.0.114
mysql -u root -p # 输入密码后进入Mysql 命令行模式
sql>create database DATA_BASE_NAME;
sql> use DATA_BASE_NAME; # 数据库名字,切换要导入的目标数据库。
sql> set names 'utf8'; # 这一步相当重要,如果原始SQL文件编码是utf8的,不加上这个语句,导入后中文是乱码
sql> source mydatabasebak.sql; # 开始导入数据。
*---------------------------------------------------------------------------------------------------------------
相关文档:
三. mysql server安装
------------------以下为扩展:删除mysql----------------
删除 mysql
sudo apt-get autoremove --purge mysql-server-5.0
sudo apt-get remove mysql-server
sudo apt-get autoremove mysql- ......
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.
......
<?php
$db_name="new";
mysql_connect("localhost","root","123456");
mysql_select_db($db_name);
$tb=mysql_list_tables($db_name);
$sql="";
while($query=mysql_fetch_row($tb)){
$sql="";$table_sql="";
$sql.= get_table_fn($query[0]);
get_table_row($que ......
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 ......
PHP新的连接MySQL方法mysqli
1. 开启PHP的API支持
(1)首先修改您的php.ini的配置文件。
查找下面的语句:
;extension=php_mysqli.dll
将其修改为:
extension=php_mysqli.dll
......