显示 所有数据库
show databases;
创建数据库
create database;
切换到该数据库
use xxx;
查看该数据的表
show tables;
创建用户
CREATE USER bolvi IDENTIFIED BY '123456';
赋予权限
grant select,insert,update,delete on bolvc1hi.* to bolvchei@'127.0.0.1';
创建新表,表名为information,有一个属性为id,在命令号中输入create table information(id int)
create table testtable(id int,name varchar(30));
<?php
$test=new PDO();
$dsn = 'mysql:dbname=bolvchuanmei;host=localhost;port=3306';
$username = 'bolvchuanmei';
$password = 'bolvkeji123';
try {
$db = new PDO($dsn, $username, $password);
} catch(PDOException $e) {
die('Could not connect to the database:
' . $e);
}
echo 'success';