MySQL基本操作

来源:互联网 发布:java语言入门 编辑:程序博客网 时间:2024/05/20 12:22
$mysql -uroot -p
输入root密码


建表
mysql>create database 库名 default character set=utf8;


建立用户,并设置密码
mysql>create user '用户'@'localhost' identified by '密码';


授权
mysql>grant all privileges on 库名.* to '用户'@'localhost';


建表
use 库名;
source f:/schema.sql


范例:
create database dtu default character set=utf8;
create user 'dtu'@'localhost' identified by 'dtu';
grant all privileges on dtu.* to 'dtu'@'localhost';


直接从现有的库导入数据和表
mysqldump -h192.168.1.246 -P3333 -udtu -pdtu dtu | mysql -udtu -pdtu dtu
原创粉丝点击