MySQL增刪改查--之改

來源:互聯網
上載者:User

標籤:MySQL更改資料

MySQL改資料1、設定root(資料庫)使用者的登入密碼

mysqladmin -uroot password "123"

2、更改root使用者登入密碼

mysqladmin -uroot -p123 password "[email protected]"

3、在資料庫裡更改使用者密碼(這裡是root使用者)

mysql> ALTER USER ‘root‘@‘localhost‘ IDENTIFIED BY ‘1234‘;

4、更新表中記錄 update 表名 set 欄位名=值,... where 條件運算式;

(1)將user表當前路徑下numer為1更新密碼為321
update user set user_passwd=password(‘321‘) where number=‘1‘;

(2)不在user表當前路徑指定路徑將numer為1更新密碼為321
update hehe.user set user_passwd=password(‘321‘) where number=‘1‘;

註:更新記錄建議指定主鍵為更新條件

5、更改資料庫使用的語言

mysql> set character_set_client = utf8;

6、更改現存在表的儲存引擎

mysql> alter table 表名 engine=引擎;

7、指定資料庫預設建立表的儲存引擎

vim /etc/my.cnf

8、更改指定庫下所有表(兩種方式)

(1)更改指定庫下所有表(或指定庫下指定表)的儲存引擎;適用與YUM
mysql_convert_table_format --user=使用者 --password=‘密碼‘ --socket=/var/lib/mysql/mysql.sock --type=引擎 庫名 [表名]

(2)更改指定庫下所有表(或指定庫下指定表)的儲存引擎;適用於源碼
mysql_convert_table_format --user=使用者 --password=‘密碼‘ --socket=/usr/local/mysql/data/mysql.sock --type=引擎 庫名 [表名]

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.