• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • CentOS安裝mysql(3)

    發表于:2013-05-23來源:博客園作者:qileilove點擊數: 標簽:MySQL
    Rows matched: 1 Changed: 1 Warnings: 0 mysql select * from test; 查看數據庫中的表的信息 +------+----------------------+ | num | name | +------+----------------------+ | 1 | Hello Everyone!

      Rows matched: 1 Changed: 1 Warnings: 0

      mysql> select * from test;  ← 查看數據庫中的表的信息

      +------+----------------------+

      | num | name      |

      +------+----------------------+

      | 1   | Hello Everyone! |  ← 確認被更新到新的值

      +------+----------------------+

      1 row in set (0.01 sec)

      mysql> delete from test where num=1;  ← 刪除表內的值

      Query OK, 1 row affected (0.00 sec)

      mysql> select * from test;  ← 確認刪除結果

      Empty set (0.01 sec)

      mysql> drop table test;  ← 刪除表

      Query OK, 0 rows affected (0.01 sec)

      mysql> show tables;  ← 查看表信息

      Empty set (0.00 sec)  ← 確認表已被刪除

      mysql> drop database test;  ← 刪除名為test的數據庫

      Query OK, 0 rows affected (0.01 sec)

      mysql> show databases;  ← 查看已存在的數據庫

      Empty set (0.01 sec)  ← 確認test數據庫已被刪除(這里非root用戶的關系,看不到名為mysql的數據庫)

      mysql> exit  ← 退出MySQL服務器

      Bye

      然后,刪除測試用過的遺留用戶。

      [root@sample ~]# mysql -u root -p ← 通過密碼用root登錄

      Enter password:  ← 在這里輸入密碼

      Welcome to the MySQL monitor. Commands end with ; or \g.

      Your MySQL connection id is 12 to server version: 4.1.20

      Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

      mysql> revoke all privileges on *.* from centospub@localhost;  ← 取消centospub用戶對數據庫的操作權限

      Query OK, 0 rows affected (0.00 sec)

      mysql> delete from mysql.user where user='centospub' and host='localhost';  ← 刪除centospub用戶

      Query OK, 1 row affected (0.01 sec)

      mysql> select user from mysql.user where user='centospub';  ← 查找用戶centospub,確認已刪除與否

      Empty set (0.01 sec)  ← 確認centospub用戶已不存在

      mysql> flush privileges;  ← 刷新,使以上操作生效

      Query OK, 0 rows affected (0.01 sec)

      mysql> exit

      Bye

      [root@sample ~]# /etc/rc.d/init.d/httpd restart  ← 重新啟動HTTP服務

      Stopping httpd:             [ OK ]

      Starting httpd:             [ OK ]

      xxx is not in the sudoers file解決方法用sudo時提示"xxx is not in the sudoers file. This incident will be reported.其中XXX是你的用戶名,也就是你的用戶名沒有權限使用sudo,我們只要修改一下/etc/sudoers文件就行了。下面是修改方法:

      1)進入超級用戶模式。也就是輸入"su -",系統會讓你輸入超級用戶密碼,輸入密碼后就進入了超級用戶模式。(當然,你也可以直接用root用)

      2)添加文件的寫權限。也就是輸入命令"chmod u+w /etc/sudoers"。

      3)編輯/etc/sudoers文件。也就是輸入命令"vim /etc/sudoers",輸入"i"進入編輯模式,找到這一 行:"root ALL=(ALL) ALL"在起下面添加"xxx ALL=(ALL) ALL"(這里的xxx是你的用戶名),然后保存(就是先按一 下Esc鍵,然后輸入":wq")退出。

      4)撤銷文件的寫權限。也就是輸入命令"chmod u-w /etc/sudoers"。

      1、添加用戶,首先用adduser命令添加一個普通用戶,命令如下:

      #adduser junguoguo//添加一個名為junguoguo的用戶

      #passwd junguoguo //修改密碼

      Changing password for user junguoguo.

      New UNIX password: //在這里輸入新密碼

      Retype new UNIX password: //再次輸入新密碼

      passwd: all authentication tokens updated successfully.

      2、賦予root權限

      方法一: 修改 /etc/sudoers 文件,找到下面一行,把前面的注釋(#)去掉

      ## Allows people in group wheel to run all commands

      %wheel ALL=(ALL) ALL

      然后修改用戶,使其屬于root組(wheel),命令如下:

      #usermod -g root junguoguo

      修改完畢,現在可以用junguoguo帳號登錄,然后用命令 su – ,即可獲得root權限進行操作。

      方法二: 修改 /etc/sudoers 文件,找到下面一行,在root下面添加一行,如下所示:

      ## Allow root to run any commands anywhere

      root ALL=(ALL) ALL

      junguoguo ALL=(ALL) ALL

      修改完畢,現在可以用junguoguo帳號登錄,然后用命令 su – ,即可獲得root權限進行操作。

      方法三: 修改 /etc/passwd 文件,找到如下行,把用戶ID修改為 0 ,如下所示:

      junguoguo:x:500:500:junguoguo:/home/junguoguo:/bin/bash

      修改后如下

      junguoguo:x:0:500:junguoguo:/home/junguoguo:/bin/bash

      保存,用junguoguo賬戶登錄后,直接獲取的就是root帳號的權限。

    原文轉自:http://www.blogjava.net/qileilove/archive/2012/05/24/379016.html

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>