[Ubuntu--mysql]mysql不用驗證也可以登陸 ?

來源:互聯網
上載者:User

ubuntu配置mysql密碼

系統內容: 
Linux ubuntu 3.5.0-27-generic #46-Ubuntu SMP Mon Mar 25 20:00:05 UTC 2013 i686 i686 i686 GNU/Linux
mysql  Ver 14.14 Distrib 5.5.29, for debian-linux-gnu (i686) using readline 6.2

安裝好了mysql 但是發現直接就進去了 連個密碼都不許要。。。
是有預設密碼還是怎麼回事呢? 
這樣試一試
lzz@ubuntu:/var/lib/dpkg/info$ sudo mysql -u root -p 
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 45
Server version: 5.5.29-0ubuntu0.12.10.1 (Ubuntu)

進來了。(其實這一次已經設定了密碼。。。我還不知到怎麼回事,下次進入的時候沒有密碼就進不來了)

lzz@ubuntu:/var/lib/dpkg/info$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 46
Server version: 5.5.29-0ubuntu0.12.10.1 (Ubuntu)

也進來了。 這樣有無密碼有什麼區別呢?查資料看看到底怎麼回事。

原來這裡有個預設的使用者和密碼
lzz@ubuntu:/etc/mysql$ sudo cat debian.cnf 
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host     = localhost
user     = debian-sys-maint
password = iyEUEJ0gy5mL42L5
socket   = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host     = localhost
user     = debian-sys-maint
password = iyEUEJ0gy5mL42L5
socket   = /var/run/mysqld/mysqld.sock
basedir  = /usr

找到這樣一個文章:
安裝安全:
    預設是可怕的
                  hack MySQL:

    MySQL預設安裝對super使用者無密碼可以登入
    匿名訪問
    在設定檔裡面提供superuser和密碼
    shell裡面帶密碼登入,history檔案
    無許可權的使用者可以訪問MySQL許可權表:整個mysql庫
    能啟動和停止mysqld進程,可以重設密碼:--skip-grant-tables
    暴力檢查
    應用使用純文字密碼,使用者可能有某些特權
                   破壞MySQL:
    竊取CPU周期:select md5(a.c),md5(b.c) from a,b order by rand();
    強迫disk I/O:set session tmp_table_size=1024*4;

    匿名訪問            

    最低限度:$mysql_secure_installation
        移除匿名使用者
        移除test庫
        移除非localhost root使用者
        設定root密碼    

對於mysql最初的時候就會個增刪等簡單操作,然後接觸的都是oracle,使用者權限管理是個大問題,應該規範些,後面在查查有沒有相關的安裝配置規範

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.