标签:mat linu bho show php rman 数据库 type lin
一、命令行方式MySQL [(none)]> show databases; #未选择数据库前,显示(none)表示在数据库跟路径下
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| sys |
| viewtest |
+--------------------+
5 rows in set (0.02 sec)
MySQL [(none)]> use viewtest;
Database changed
MySQL [viewtest]> #选择数据库后,就会显示你当前的数据库名称
语法:
mysqli_select_db(connection,dbname)
实例操作:
[root@mysql-linuxview web]# cat query.php
<?
$dbhost = ‘localhost:3306‘;
$dbuser = ‘root‘;
$dbpass = ‘000000‘;
$conn = mysqli_connect($dbhost,$dbuser,$dbpass);
if ( ! $conn)
{
die(‘连接失败:‘ . mysqli_error($conn));
}
echo ‘连接数据库成功!!!‘;
mysqli_select_db($conn,‘viewtest‘);
mysqli_close($conn);
?>
[root@mysql-linuxview web]#
效果图:
1.
2.
标签:mat linu bho show php rman 数据库 type lin
原文地址:http://blog.51cto.com/leoheng/2165147