MySQLのセットアップ

mysql_install_dbを実行

www# /usr/local/bin/mysql_install_db
Installing MySQL system tables...
OK
Filling help tables...

OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/local/bin/mysqladmin -u root password 'new-password'
/usr/local/bin/mysqladmin -u root -h www.my.domain password 'new-password'

Alternatively you can run:
/usr/local/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/local ; /usr/local/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/bin/mysqlbug script!

The latest information about MySQL is available at http://www.mysql.com/
Support MySQL by buying support/licenses from http://shop.mysql.com/

www#

DBが作成されていることを確認

www# ls /var/db/mysql
mysql test
www#

/etc/rc.confの設定


サーバー起動時にMySQLが起動されるようにrc.confに下記の行を追加

mysql_enable="YES"

サーバーをリブートしMySQLを起動


サーバーを再起動しMySQLが起動するか確認する。

www# ps -aux | grep mysql
root 693 0.0 0.1 372 252 p0 R+ 7:02AM 0:00.00 grep mysql
www#


起動していない?

[MySQL]DBのオーナーを変更する。


多分、MySQLが起動しない原因はこれだ。

www# cd /var/db
www# chown -R mysql:mysql mysql
www#

[FreeBSD][MySQL]サーバーをリブートしMySQLの起動を確認

%ps -aux | grep mysql
mysql 473 0.0 0.3 1728 1316 con- I 7:16AM 0:00.01 /bin/sh /usr/local/bin/mysqld_safe --defaults-extra-file=/var/db/mysql/my.cnf --user=mysql --datadir=/
mysql 530 0.0 5.6 42712 25008 con- S 7:16AM 0:00.23 /usr/local/libexec/mysqld --defaults-extra-file=/var/db/mysql/my.cnf --basedir=/usr/local --datadir=/v
%

[FreeBSD][MySQL]MySQLのrootのパスワードを設定

/usr/local/bin/mysqladmin -u root password 'new-password'

'new-password'には任意の文字列を設定する。


mysql DBに接続できることを確認

mysql -u root -p mysql
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.23-rc FreeBSD port: mysql-server-5.1.23

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

MySQLを起動後のWebmin


MySQLにログイン後のWebmin