创建MYSQL DATABASE错误

时间:2016-12-11 15:54:13

标签: php mysql database

我尝试使用此脚本创建数据库

    //CREATE MYSQL DATABASE
$query = "CREATE DATABASE IF NOT EXISTS " . $config['database'] . " CHARACTER SET utf8 COLLATE utf8_general_ci";
if ($connection->query($query) === TRUE) {
    $query = "USE " . $config['database'];
    if ($connection->query($query) === TRUE) {
        $progress .= "Database " . $config['database'] . " set up successfully.<br>";
    }
} else {
    return_error("MySQL connection successful but error setting up database: " . $connection->error);
}

我得到了这个错误而无法识别问题。有任何想法吗 ?

MySQL连接成功但错误设置数据库:您的SQL语法出错;查看与您的MySQL服务器版本对应的手册,以便在#CHAR; CHARACTER SET附近使用正确的语法utf8 COLLATE utf8_general_ci&#39;在第1行

谢谢

0 个答案:

没有答案