时间:2021-07-01 10:21:17 帮助过:20人阅读
使用PHP脚本创建数据库 mysql_query() bool mysql_query( sql, connection );
<html> <head> <title>创建MySQL数据库</title> </head> <body> <?php $dbhost = ‘localhost:3036‘; $dbuser = ‘root‘; $dbpass = ‘‘; $conn = mysql_connect($dbhost, $dbuser, $dbpass); if(! $conn ) { die(‘Could not connect: ‘ . mysql_error()); } echo ‘Connected successfully<br />‘; $sql = ‘CREATE DATABASE yiibai‘; $retval = mysql_query( $sql, $conn ); if(! $retval ) { die(‘Could not create database: ‘ . mysql_error()); } echo "Database yiibai created successfully\n"; mysql_close($conn); ?>
</body>
</html>
2.建表 CREATE TABLE table_name (column_name column_type);
create table emp( id int, ename varchar(30), age int, job varchar(20) );
2.
Mysql 知识点总结
标签:could int mysql数据库 nbsp column roo error 数据 log