Mysql 为应用数据库创建新用户

假如我们再使用mantis bug tool来管理项目bug。那我们需要为为其在mysql中建立一个专属数据库bugtracker。

以下步骤是需要做的:

1.创建bugtracker数据库供mantis来使用,here we go! simplely type in these code:

mysql>mysql -uroot -proot

mysql>create database bugtracker default charset utf8 COLLATE utf8_unicode_ci;

如果你不太明白后面彩色文字的意思,请访问 http://dev.mysql.com/doc/refman/5.0/en/create-database.html

to make a full understanding~!

 

2.创建bugtracker的用户mantis(Suppose you'v already been logged in with root user)

mysql>create user mantis identified by 'report';

如果你的mantis和mysql是在同一个地方,msyql will treat mantis as localhost user, 所以,可以这样来给刚创建的用户赋予权限

mysql>grant all privileges on bugtracker.* to mantis@localhost;

如果你的mantis和mysql在不同的地方(机器),I know u can figure out ~! suppose your ip is '10.78.1.23'

mysql>greant all privileges on bugtracker.* to mantis@10.78.1.23;

这样可以使得10.78.1.23(may be a use in LAN)连接到bugtracker数据库,we 'll just say 'NO' to others~!

 

other usefull commands in mysql:

连接:Connection remote

cmd>mysql -h 10.78.1.23 -umantis -preport

查看:Databases & Tables & Fields

mysql>show databases;

mysql>use bugtracker; show tables;

mysql>desc mantis_bug_table;

导入脚本:Import Scripts from local file-system

cmd>mysql -umantis -preport [database]< /home/superman/script/mantis-mysql.sql

'[database]' is required only when we only create tables in our scripts.

another way

mysql>source c:/scripts/myscript.sql

 

导出:backup your database   

cmd>mysqldump -umantis -preport bugtracker > /home/superman/backup/mantis.sql

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

dyyaries

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值