MySQL常用設定

來源:互聯網
上載者:User

安裝:

apt-get install mysql_server

添加使用者:

    mysql> GRANT ALL PRIVILEGES ON *.* TO 'freebird'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
'freebird' 使用者名稱
'123456' 密碼
'%' 指從本機之外都可以串連,如果換成'localhost',就只能從本機發起串連
ALL PRIVILEGES 賦予freebird任何許可權
    You can limit the user's power on one data base:
GRANT ALL PRIVILEGES ON artsysdb.* TO 'lizhan'@'%' IDENTIFIED BY 'lizhan' WITH GRANT OPTION;
    More detail information please refer to 11.5.1.3. GRANT Syntax of the mysql document.
 
    By default,root has no power to access database remotely.


以下配置需要修改/etc/mysql/my.cnf檔案

使用InnoDB:

[mysqld]下面加入default-storage-engine=INNODB一句

注意,Ubuntu server 12.04 下的MySQL 5.5預設是innodb.不需要設定。

使用utf-8字元集:

預設情況下,Ubuntu server 12.04的MySQL5.5

mysql> show variables like 'character%';+--------------------------+----------------------------+| Variable_name            | Value                      |+--------------------------+----------------------------+| character_set_client     | utf8                       || character_set_connection | utf8                       || character_set_database   | latin1                     || character_set_filesystem | binary                     || character_set_results    | utf8                       || character_set_server     | latin1                     || character_set_system     | utf8                       || character_sets_dir       | /usr/share/mysql/charsets/ |+--------------------------+----------------------------+8 rows in set (0.00 sec)mysql> 

因此只需要在mysqld下面添加:

character-set-server = utf8

下面的適用於老版本。5.5會報錯。


[mysqld]default-character-set=utf8init_connect='SETNAMES utf8'(設定串連mysql資料庫時使用utf8編碼,以讓mysql資料庫為utf8運行)[client]default-character-set=utf8預設字元集為utf8  

不區分大小寫:

[mysqld]
lower_case_table_names=1

遠端存取許可權:

[mysqld]

bind-address            = 192.168.1.200

最大串連數修改:

[mysqld]
max_connection=1024

相關文章

聯繫我們

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