安裝:
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