在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 教程/ 數(shù)據(jù)庫/ 創(chuàng)建 MySQL 數(shù)據(jù)庫
MySQL 復(fù)制表
MySQL ALTER 命令
MySQL 安裝
MySQL 日期與時(shí)間方面的函數(shù)
MySQL SQL Injection
MySQL 排序結(jié)果
MySQL 臨時(shí)表
MySQL 介紹
MySQL 數(shù)據(jù)導(dǎo)出
MySQL 索引
MySQL 數(shù)值函數(shù)
MySQL 更新查詢
MySQL UNION 關(guān)鍵字
MySQL RAND 函數(shù)
創(chuàng)建 MySQL 數(shù)據(jù)庫
MySQL AVG 函數(shù)
MySQL Using Join
MySQL Handling Duplicates
MySQL SUM 函數(shù)
MySQL 數(shù)據(jù)類型
MySQL 插入查詢
MySQL 字符串函數(shù)
MySQL Using Sequences
MySQL 管理
MySQL 數(shù)據(jù)導(dǎo)入
MySQL BETWEEN 子句
MySQL MIN 函數(shù)
創(chuàng)建 MySQL 表
MySQL Group By 子句
MySQL COUNT 函數(shù)
MySQL 匯報(bào)
MySQL 選擇數(shù)據(jù)庫
MySQL Where Clause
MySQL 選擇查詢
MySQL Like Clause
MySQL 正則表達(dá)式
一些非常有用的學(xué)習(xí)資源
MySQL NULL Values
MySQL 刪除查詢
MySQL 數(shù)據(jù)庫信息
一些有用的 MySQL 函數(shù)與子句
MySQL 刪除表
MySQL MAX 函數(shù)
MySQL SQRT 函數(shù)
MySQL 終止數(shù)據(jù)庫
連接 MySQL 服務(wù)器
MySQL IN 子句
MySQL CONCAT 函數(shù)
MySQL PHP語法

創(chuàng)建 MySQL 數(shù)據(jù)庫

使用 mysqladmin 創(chuàng)建數(shù)據(jù)庫

創(chuàng)建或刪除數(shù)據(jù)庫需要擁有特殊的權(quán)限。假設(shè)你獲得了root用戶權(quán)限,那么利用 mysqladmin 二進(jìn)制命令可以創(chuàng)建任何數(shù)據(jù)庫。

范例

下面就來創(chuàng)建一個(gè)名叫 TUTORIALS 的數(shù)據(jù)庫:

[root@host]# mysqladmin -u root -p create TUTORIALS
Enter password:******

通過上述命令,就創(chuàng)建好了一個(gè)名叫 TUTORIALS 的 MySQL 數(shù)據(jù)庫。

利用PHP腳本創(chuàng)建數(shù)據(jù)庫

PHP利用 mysql_query 函數(shù)來創(chuàng)建或刪除 MySQL 數(shù)據(jù)庫。該函數(shù)有2個(gè)參數(shù),成功執(zhí)行操作則返回TRUE,失敗則返回FALSE。

語法

bool mysql_query( sql, connection );

參數(shù) 說明
sql 必需參數(shù)。創(chuàng)建或刪除 MySQL 數(shù)據(jù)庫所用的 SQL 命令。
connection 可選參數(shù)。如未指定,將使用最后一個(gè)由 mysql_connect 打開的連接。

范例

通過下面這個(gè)范例來了解如何創(chuàng)建數(shù)據(jù)庫。

<html>
<head>
<title>Creating MySQL Database</title>
</head>
<body>
<?php
$dbhost = 'localhost:3036';
$dbuser = 'root';
$dbpass = 'rootpassword';
$conn = mysql_connect($dbhost, $dbuser, $dbpass);
if(! $conn )
{
  die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully<br />';
$sql = 'CREATE DATABASE TUTORIALS';
$retval = mysql_query( $sql, $conn );
if(! $retval )
{
  die('Could not create database: ' . mysql_error());
}
echo "Database TUTORIALS created successfully\n";
mysql_close($conn);
?>
</body>
</html>