Last Update: "2010/02/28 13:21:46 makoto"
20050605
ttyp0:makoto@umax 10:51:01/050605(~)> sudo env mysqld=YES /etc/rc.d/mysqld start
Password:
Starting mysqld.
eval: /usr/pkg/bin/mysqld_safe: not found
実は mysql が入っていなかった。
- pkg_add mysql-server
- $ echo "mysqld=yes" >> /etc/rc.conf # NetBSD or a system with rc.d
- sudo cp -p /usr/pkg/share/examples/rc.d/*mysql* /etc/rc.d/
- sudo env mysqld=YES /etc/rc.d/mysqld start
pkg_add
ttyp0:makoto@umax 10:55:25/050605(...3.99.3/All)> sudo pkg_add mysql-server
===========================================================================
$NetBSD: MESSAGE,v 1.1 2004/12/02 00:42:06 xtraeme Exp $
To use the ``mysqlhotcopy'' script, you'll have to install the following
packages:
devel/p5-File-Temp
databases/p5-DBD-mysql
===========================================================================
Creating group: mysql
Creating user: mysql
===========================================================================
$NetBSD: MESSAGE,v 1.6 2005/03/08 16:48:11 xtraeme Exp $
You can start the MySQL server doing the following steps:
$ echo "mysqld=yes" >> /etc/rc.conf # NetBSD or a system with rc.d
If you are using PKG_RCD_SCRIPTS=YES, try the following:
$ /etc/rc.d/mysqld start
Otherwise try:
$ /usr/pkg/share/examples/rc.d/mysqld start
After the tables are set up and the MySQL server is running,
please remember to set a password for the MySQL root user!
This is done by running both:
/usr/pkg/bin/mysqladmin -u root -p password 'new-password'
/usr/pkg/bin/mysqladmin -h `hostname` -u root -p password 'new-password'
The "Enter password:" prompt is asking for the existing password.
As there is no existing password, just press the Return key.
There is a script distributed with MySQL that can help you lock down
an installation. This script has been installed to
/usr/pkg/bin/mysql_secure_installation.
Please see the manual and the MySQL web site for more instructions.
===========================================================================
ttyp0:makoto@umax 10:57:19/050605(...3.99.3/All)> his
ttyp0:makoto@umax 11:04:16/050605(...3.99.3/All)> /usr/pkg/bin/mysqladmin -u root -p password 'new-passwd'
Enter password:
/usr/pkg/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (61)'
Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!
ttyp0:makoto@umax 11:04:51/050605(...3.99.3/All)> ls /tmp/my*
/tmp/mysql.sock=
(err)
起動したはずなのに、起動していない場合には、次のところに何か書いてあります。
/var/mysql/hostname.err
例えば、このような内容です
050805 11:08:10 Starting mysqld daemon with databases from /var/mysql
050805 11:08:10 mysqld started
050605 11:08:10 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights to
InnoDB: the directory.
InnoDB: File name ./ibdata1
InnoDB: File operation call: 'open'.
InnoDB: Cannot continue operation.
050805 11:08:10 STOPPING server from pid file /var/mysql/umax.pid
050805 11:08:10 mysqld ended
何故か user が変ってしまっているので
ttyp0:makoto@umax 11:11:31/050605(...3.99.3/All)> ls -l /var/mysql/
total 41066
-rw-rw---- 1 tinyproxy tinyproxy 25088 Apr 19 14:09 ib_arch_log_0000000000
-rw-rw---- 1 tinyproxy tinyproxy 5242880 Apr 19 14:09 ib_logfile0
-rw-rw---- 1 tinyproxy tinyproxy 5242880 Apr 19 14:09 ib_logfile1
-rw-rw---- 1 tinyproxy tinyproxy 10485760 Apr 19 14:09 ibdata1
drwx------ 2 tinyproxy tinyproxy 512 Apr 19 14:07 mysql/
-rw-rw---- 1 mysql tinyproxy 2628 Jun 5 11:08 umax.err
ttyp0:makoto@umax 11:11:33/050605(...3.99.3/All)
もう一度設置時に必要なことを実行
141 11:12 sudo chown -R mysql:mysql /var/mysql
142 11:12 sudo /usr/pkg/bin/mysql_install_db --user=mysql
ps ax で見ると、今度は動いています
ttyp0:makoto@umax 11:14:20/050605(...3.99.3/All)> ps ax | grep sql
1251 ttyp0 Sa 0:00.79 /usr/pkg/libexec/mysqld --basedir=/usr/pkg --datadir=/var/mysql --user=mysql --pid-file=/var/mysql/umax.pid
18532 ttyp0 S 0:00.04 /bin/sh /usr/pkg/bin/mysqld_safe --user=mysql --datadir=/var/mysql --pid-file=/var/mysql/umax.pid
24203 ttyp0 R+ 0:00.01 grep sql
しかし:
ttyp0:makoto@umax 11:14:45/050605(~)> /usr/pkg/bin/mysqladmin -h `hostname` -u root -p password 'new-password'
Enter password:
/usr/pkg/bin/mysqladmin: connect to server at 'umax' failed
error: 'Host 'umax' is not allowed to connect to this MySQL server'
次のようにする。Enter password: には上で設定した root のパスワードを入れる
ttyp0:makoto@umax 11:41:13/050605(...3.99.3/All)> mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 20 to server version: 4.1.11
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> delete from mysql.user where host;
Query OK, 0 rows affected (0.01 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>
grant
http://www.dream-seed.com/linux/mysql.html
ttyp0:makoto@umax 11:47:05/050605(...3.99.3/All)> mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 22 to server version: 4.1.11
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> grant all on your_hostname.* to your_login@localhost identified by 'hogehoge';
Query OK, 0 rows affected (0.02 sec)
mysql>
|