mysql啟動修改密碼

來源:互聯網
上載者:User

標籤:mysql啟動命令 mysql修改密碼 mysql忘記密碼

一.mysql 啟動方法
    1./etc/init.d/mysqld start
    2./usr/local/mysql/bin/mysqld_safe --user=mysql &

        &:代表後台啟動mysql服務

二.mysql 登陸方法:
    1.剛裝完系統沒密碼情況:mysql 或者mysql -uroot
    2.標準的登陸方法:mysql -uroot -p
    3.多執行個體登陸方法:
        mysql -uroot -p -S /data/3306/mysql.sock    #指定下sock檔案
        mysql -uroot -p -S /data/3307/mysql.sock
三.mysql關閉方法
    1.用專門的指令碼關閉
四.mysql建使用者.並授權方法
    1.分2步的方法:
         create user ‘test‘@‘localhost‘ identified by ‘test11‘;
         grant select on mysql.* to ‘test‘@‘localhost‘ ;
    2.直接一條命令:
        mysql> grant select on mysql.* to ‘test2‘@‘localhost‘ identified by ‘test22‘;
        Query OK, 0 rows affected (0.00 sec)  
        mysql> select user,host from user;    
        +-----------+-----------+
        | user      | host      |
        +-----------+-----------+
        | root      | 127.0.0.1 |
        | root      | localhost |
        | test      | localhost |
        | test2     | localhost |
        | wordpress | localhost |
        +-----------+-----------+
        5 rows in set (0.00 sec)
五.mysql修改密碼方法:
    1.安裝完後,設定密碼方法:
        a.mysqladmin -uroot -password  ‘test88‘
        b.mysqladmin -uroot -password  ‘test88‘ -S    /data/3306/mysql.sock     #多執行個體的例子
    2.修改密碼
        a. [[email protected]~]# mysqladmin -uroot -p‘mybaby99‘ password ‘ainini99‘
        b. [[email protected]~]# mysqladmin -uroot -p‘mybaby99‘ password ‘ainini99‘ -S /data/3306/mysql.sock
六.找回丟失密碼:
    1.單一實例
        [[email protected] ~]# killall mysqld
        [[email protected] ~]# mysqld_safe --skip-grant-table & mysql -uroot -p
        mysql> use mysql;
        Database changed
        mysql> update user set password=password(‘mygirl99‘) where user=‘root‘;
        Query OK, 2 rows affected (0.00 sec)
        Rows matched: 2  Changed: 2  Warnings: 0

        mysql> flush privileges;  
        Query OK, 0 rows affected (0.00 sec)
   
你可能還對mysql編譯參數查看的相關內容感興趣

mysql啟動修改密碼

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.