ubuntu12.04でMySQLをインストール、設定する方法

1.MySQLをインストール
sudo apt-get install mysql-server
sudo apt-get install mysql-workbench

2.UTF8文字エンコーディングを設定
sudo gedit /etc/mysql/my.cnf
[mysqd]の下に下記内容を追加
character-set-server=utf8

保存、MySQLが再起動
sudo /etc/init.d/mysql restart
mysql -uroot -p
show variables like 'character%’;
+————————–+—————————-+

| Variable_name | Value |

+————————–+—————————-+

| character_set_client | utf8 |

| character_set_connection | utf8 |

| character_set_database | utf8 |

| character_set_filesystem | binary |

| character_set_results | utf8 |

| character_set_server | utf8 |

| character_set_system | utf8 |

| character_sets_dir | /usr/share/mysql/charsets/ |

+————————–+—————————-+

8 rows in set (0.00 sec)

3.ユーザーを作成、権限を配置
create user startnews24 IDENTIFIED BY 'startnews24_pwd’;
GRANT ALL PRIVILEGES ON *.* TO startnews24@localhost;

Linux

Posted by arkgame