mysql forige key
Love in coding...
Free and Susan
[引]MySQL INNODB类型表的外键关联设置
Here is a simple example that relates parent and child tables through a single-column foreign key:
CREATE TABLE parent (id INT NOT NULL,
PRIMARY KEY (id)
) ENGINE=INNODB;
CREATE TABLE child (id INT, parent_id INT,
INDEX par_ind (parent_id),
FOREIGN KEY (parent_id) REFERENCES parent(id)
ON DELETE CASCADE
) ENGINE=INNODB;
A more complex example in which a product_order table has foreign keys for two other tables.
One foreign key references a two-column index in the product table.
The other references a single-column index in the customer table:
CREATE TABLE product (category INT NOT NULL, id INT NOT NULL,
price DECIMAL,
PRIMARY KEY(category, id)) ENGINE=INNODB;
CREATE TABLE customer (id INT NOT NULL,
PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE product_order (no INT NOT NULL AUTO_INCREMENT,
product_category INT NOT NULL,
 
相关文档:
[root@pku-fan MySQL]# cat limbs.sql
CREATE DATABASE cookbook;
USE cookbook;
DROP TABLE IF EXISTS limbs;
CREATE TABLE limbs
(
thing VARCHAR(20), # what the thing is
legs INT, ......
1。 改表法。可能是你的帐号不允许从远程登陆,只能在localhost。这个时候只要在localhost的那台电脑,登入mysql后,更改 "mysql" 数据库里的 "user" 表里的 "host" 项,从"localhost"改称"%"
mysql -u root -p
mysql>use mysql;
mysql>update user set& ......
运行环境:windows xp sp2
IIS v5.1
PHP 5.3.1-Win32-VC9-x86
Mysql 5.0
安装步骤:
安装IIS5.1
在 ......
首先要声明一点,大部分情况下,修改MySQL是需要有mysql里的root权限的,
所以一般用户无法更改密码,除非请求管理员。
方法一
使用phpmyadmin,这是最简单的了,修改mysql库的user表,
不过别忘了使用PASSWORD函数。
方法二
使用mysqladmin,这是前面声明的一个特例。
mysqladmin -u root -p password mypas ......
my.cnf 或者是 my.ini
在[MySQL(和PHP搭配之最佳组合)d]配置段添加:
max_connections = 1000
保存,重启MySQL(和PHP搭配之最佳组合)服务。
然后用命令:
MySQL(和PHP搭配之最佳组合)admin -uroot -p variables
输入root数据库账号的密码后可看到
| max_connections | 1000 |
启动mysql服务
RedHat ......