mysql基本使用与注意事项

连接远程数据库

  1. 语法:mysql -h host -P port -u user -ppassword
    注意:大写P表示端口,小写p表示密码,且小写p参数与密码之间不能有空格,否则将会被识别为连接的数据库名称

使用

  1. 查看表内数据数量:select count( colume_name ) from table_name
  2. 创建表:
    1
    2
    3
    4
    create table `table_name`(
    `colume_name` int not null primary key,
    `colume_name` datetime null,
    )
    注意:列命和表名需要使用反引号!