zoukankan      html  css  js  c++  java
  • Mysql 知识点总结

    1.创建数据库    mysqladmin

    下面是一个简单的例子,创建名为 yiibai_tutorials1 的数据库。
    
    D:softwaremysql-5.6.25-winx64in> mysqladmin -u root -p create yiibai
    Enter password:<回车>
    
    或
    
    D:softwaremysql-5.6.25-winx64in> mysql -u root -p Enter password: mysql>create database yiibai;

    使用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
    "; 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.

  • 相关阅读:
    服务器重启后oracle监听无法打开
    Resport 四则运算
    For循环
    do...while循环
    Day03_Class01
    自学JavaDay02_class02
    自学JavaDay02_class01
    自学JavaDay01
    基本的Dos命令
    MarkDown语法
  • 原文地址:https://www.cnblogs.com/shenzikun1314/p/6767867.html
Copyright © 2011-2022 走看看