自動起動設定
cp /home/webadmin/src/mysql-6.0.6-alpha/support-files/mysql.server /etc/rc.d/init.d/mysql
chmod 755 /etc/rc.d/init.d/mysql
chkconfig --add mysql
ポート開放
/sbin/iptables -I INPUT -p tcp -m tcp --dport 3306 --syn -j ACCEPT
Mysql用スーパーユーザーの設定
今回はrootユーザーにパスワード"mysql"を設定しています。
html2 plugin Error : このプラグインで利用できない命令または文字列が入っています。
データベース
データベース"testdb"を作成しました
$ mysql -u root -p
Enter password: ????
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 6.0.6-alpha Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> create database testdb;
Query OK, 1 row affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| test |
| testdb |
+--------------------+
4 rows in set (0.10 sec)
mysql> quit
ユーザーの作成
"root"ユーザーと"testuser"ユーザーを全てのIPから参照できるように対応
$ mysql -u root -p
Enter password: ????
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 6.0.6-alpha Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> grant all privileges on *.* to root@'%' identified by '????';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on *.* to testuser@'%' identified by '????';
Query OK, 0 rows affected (0.00 sec)
mysql> quit
※identified by '????';はパスワードを指定する
テスト接続、データベース選択、テーブル作成
$ mysql -u testuser -h 192.168.10.141 -p
Enter password:????
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 6.0.6-alpha Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use testdb;
Database changed
mysql>
create table testtable1(
key1 varchar(50) primary key
, data1 varchar(50)
, data2 varchar(50)
, data3 varchar(50)
);
Query OK, 0 rows affected (0.05 sec)
mysql> Ctrl-C -- exit!
Aborted
$
mysql> quit
最終更新:2010年06月07日 21:19