mysql错误 错误提示: 连接 MYSQL 数据库错误(TCP:8806)! 求解
发布网友
发布时间:2022-05-01 05:05
我来回答
共1个回答
热心网友
时间:2022-05-01 06:34
你这是哪种语言链接MYSQL数据库?
<?php
$mysql_server_name='localhost';
$mysql_username='root';
$mysql_password='12345678';
$mysql_database='mycounter';
$conn=mysql_connect($mysql_server_name,$mysql_username,$mysql_password,$mysql_database);
$sql='CREATE DATABASE mycounter DEFAULT CHARACTER SET gbk COLLATE gbk_chinese_ci;
';
mysql_query($sql);
$sql='CREATE TABLE `counter` (`id` INT(255) UNSIGNED NOT NULL AUTO_INCREMENT ,`count` INT(255) UNSIGNED NOT NULL DEFAULT 0,PRIMARY KEY ( `id` ) ) TYPE = innodb;';
mysql_select_db($mysql_database,$conn);
$result=mysql_query($sql);
//echo $sql;
mysql_close($conn);
echo "Hello!数据库mycounter已经成功建立!";
?>