日期:2014-05-16  浏览次数:20721 次

mySql常用的操作--集锦
登录 root用户名 root密码 
C:\Documents and Settings\Administrator>mysql -uroot -pROOT
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 47
Server version: 5.1.48-community MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

创建数据库
mysql> create database test;

查看数据库
mysql> show databases;

删除数据库
mysql> drop database test;

更换数据库
mysql> use test;

导入sql语句
mysql> source 文件地址

导出sql语句  数据库test  表 product_category 多表用空格分隔
mysqldump -uroot -proot test product_category  > c:\product_category.sql

查看数据库表
mysql> show tables;

修改数据库表字段类型
ALTER TABLE sub_company MODIFY COLUMN latitude  DECIMAL(10,6);