( ! ) Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKBase.class.php on line 114
Call Stack
#TimeMemoryFunctionLocation
10.0013414240{main}( ).../index.php:0
20.07934265232Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.495015945632Joomla\CMS\Application\SiteApplication->render( ).../CMSApplication.php:202
40.495215945688Joomla\CMS\Application\SiteApplication->render( ).../SiteApplication.php:778
50.495215946064Joomla\CMS\Document\HtmlDocument->parse( ).../CMSApplication.php:1030
60.495215946064Joomla\CMS\Document\HtmlDocument->_fetchTemplate( ).../HtmlDocument.php:545
70.495315946160Joomla\CMS\Document\HtmlDocument->_loadTemplate( ).../HtmlDocument.php:730
80.495615984400require( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/component.php' ).../HtmlDocument.php:668
90.499516276344GKTemplate->__construct( ).../component.php:31
100.505416430224GKTemplateMenu->getMenuType( ).../gk.framework.php:84
110.506016474192require_once( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKMenu.php' ).../helper.menu.php:19

( ! ) Warning: "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/lib/menu/GKHandheld.php on line 76
Call Stack
#TimeMemoryFunctionLocation
10.0013414240{main}( ).../index.php:0
20.07934265232Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.495015945632Joomla\CMS\Application\SiteApplication->render( ).../CMSApplication.php:202
40.495215945688Joomla\CMS\Application\SiteApplication->render( ).../SiteApplication.php:778
50.495215946064Joomla\CMS\Document\HtmlDocument->parse( ).../CMSApplication.php:1030
60.495215946064Joomla\CMS\Document\HtmlDocument->_fetchTemplate( ).../HtmlDocument.php:545
70.495315946160Joomla\CMS\Document\HtmlDocument->_loadTemplate( ).../HtmlDocument.php:730
80.495615984400require( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/component.php' ).../HtmlDocument.php:668
90.499516276344GKTemplate->__construct( ).../component.php:31
100.508216597440GKTemplateMenu->getMenuType( ).../gk.framework.php:85
MYSQL添加新用户和数据库(命令行模式和phpmyadmin)
Logo
Print this page

MYSQL添加新用户和数据库(命令行模式和phpmyadmin)

MYSQL添加新用户和数据库(命令行模式和phpmyadmin)

一、命令行模式

首先要声明一下:一般情况下,修改MySQL密码,授权,是需要有mysql里的root权限的。
注:本操作是在WIN命令提示符下,phpMyAdmin同样适用。
用户:phplamp
用户数据库:phplampDB

1.新建用户

//登录MYSQL
@>mysql -u root -p
@>密码
//创建用户
mysql> insert into mysql.user(Host,User,Password) values('localhost','phplamp',password('1234'));
//刷新系统权限表
mysql>flush privileges;
这样就创建了一个名为:phplamp  密码为:1234  的用户。

//退出后登录一下
mysql>exit;
@>mysql -u phplamp -p
@>输入密码
mysql>登录成功

2.为用户授权

//登录MYSQL(有ROOT权限)。我里我以ROOT身份登录.
@>mysql -u root -p
@>密码
//首先为用户创建一个数据库(phplampDB)
mysql>create database phplampDB;
//授权phplamp用户拥有phplamp数据库的所有权限
@>grant all privileges on phplampDB.* to phplamp@localhost identified by '1234';
//刷新系统权限表
mysql>flush privileges;
mysql>其它操作

//如果想指定部分权限给一用户,可以这样来写:
mysql>grant select,update on phplampDB.* to phplamp@localhost identified by '1234';
//刷新系统权限表。
mysql>flush privileges;

mysql> grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by ‘连接口令’;

权限1,权限2,…权限n代表select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14个权限。
当权限1,权限2,…权限n被all privileges或者all代替,表示赋予用户全部权限。
当数据库名称.表名称被*.*代替,表示赋予用户操作服务器上所有数据库所有表的权限。
用户地址可以是localhost,也可以是ip地址、机器名字、域名。也可以用’%'表示从任何地址连接。
‘连接口令’不能为空,否则创建失败。

例如:
mysql>grant select,insert,update,delete,create,drop on vtdc.employee to This email address is being protected from spambots. You need JavaScript enabled to view it. identified by ‘123′;
给来自10.163.225.87的用户joe分配可对数据库vtdc的employee表进行select,insert,update,delete,create,drop等操作的权限,并设定口令为123。

mysql>grant all privileges on vtdc.* to This email address is being protected from spambots. You need JavaScript enabled to view it. identified by ‘123′;
给来自10.163.225.87的用户joe分配可对数据库vtdc所有表进行所有操作的权限,并设定口令为123。

mysql>grant all privileges on *.* to This email address is being protected from spambots. You need JavaScript enabled to view it. identified by ‘123′;
给来自10.163.225.87的用户joe分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123。

mysql>grant all privileges on *.* to joe@localhost identified by ‘123′;
给本机用户joe分配可对所有数据库的所有表进行所有操作的权限,并设定口令为123。

3.删除用户

@>mysql -u root -p
@>密码
mysql>DELETE FROM user WHERE User="phplamp" and Host="localhost";
mysql>flush privileges;
//删除用户的数据库
mysql>drop database phplampDB;

4.修改指定用户密码

@>mysql -u root -p
@>密码
mysql>update mysql.user set password=password('新密码') where User="phplamp" and Host="localhost";
mysql>flush privileges;
mysql>quit;

二、利用phpmyadmin

1、成功登陆后的首页里填入新建的数据库名"sqlname",点击“创建”来新建数据库(如果创建不能成功,说明你没有管理权限)
2、然后点击左边工具栏上部的“主目录”,然后点击右边栏里的“权限”
3、然后点击右边栏里的“添加新用户”
4、输入数据库用户名username、主机、密码后,点击下部的“执行”(除非你添加的是管理员,否则无需设置下面的“全局权限”)。
5、然后在“按数据库指定权限”的下拉框中找到刚才添加的数据库"sqlname",选定后自动跳转到下一页面。
6、在“按数据库指定权限”里全部点选,点击“执行”确定。
7、下一页面上部出现了“您已经更新了'username'@'localhost'的权限”时,说明操作成功。

Last modified onSaturday, 05 January 2013 13:22

( ! ) Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 169
Call Stack
#TimeMemoryFunctionLocation
10.0013414240{main}( ).../index.php:0
20.07934265232Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.07934265232Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.401011456552Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.401611481280Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.402211536608Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.402511564008require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.410111963640K2ControllerItem->execute( ).../k2.php:64
90.410111963640K2ControllerItem->display( ).../BaseController.php:710
100.419212614344K2ControllerItem->display( ).../item.php:78
110.419212614344K2ControllerItem->display( ).../controller.php:19
120.423112985384Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.425013005752K2ViewItem->display( ).../ViewController.php:102
140.490215933608K2ViewItem->display( ).../view.html.php:742
150.490215933608K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.491816106544include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701
  • Published in 主机
  • Read 3699 times

( ! ) Notice: Only variables should be assigned by reference in /var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php on line 478
Call Stack
#TimeMemoryFunctionLocation
10.0013414240{main}( ).../index.php:0
20.07934265232Joomla\CMS\Application\SiteApplication->execute( ).../index.php:49
30.07934265232Joomla\CMS\Application\SiteApplication->doExecute( ).../CMSApplication.php:196
40.401011456552Joomla\CMS\Application\SiteApplication->dispatch( ).../SiteApplication.php:233
50.401611481280Joomla\CMS\Component\ComponentHelper::renderComponent( ).../SiteApplication.php:194
60.402211536608Joomla\CMS\Component\ComponentHelper::executeComponent( ).../ComponentHelper.php:377
70.402511564008require_once( '/var/www/vhosts/shan.info/httpdocs/components/com_k2/k2.php' ).../ComponentHelper.php:402
80.410111963640K2ControllerItem->execute( ).../k2.php:64
90.410111963640K2ControllerItem->display( ).../BaseController.php:710
100.419212614344K2ControllerItem->display( ).../item.php:78
110.419212614344K2ControllerItem->display( ).../controller.php:19
120.423112985384Joomla\CMS\Cache\Controller\ViewController->get( ).../BaseController.php:663
130.425013005752K2ViewItem->display( ).../ViewController.php:102
140.490215933608K2ViewItem->display( ).../view.html.php:742
150.490215933608K2ViewItem->loadTemplate( ).../HtmlView.php:230
160.491816106544include( '/var/www/vhosts/shan.info/httpdocs/templates/gk_publisher/html/com_k2/templates/default/item.php' ).../HtmlView.php:701
Template Design © Joomla Templates | GavickPro. All rights reserved.