mysql mysql mysql> select user,host,password from user; +------+-----------+----------+ | user | host | password | +------+-----------+----------+ | root | locahost | | | root | hostname | | | root | 127.0.0.1 | | | | locahost | | | | hostname | | +------+-----------+----------+ と、初期状態ではパスワード無し、ユーザー無しなので 空欄ユーザーは削除、rootにはパスワードを設定する。 DELETE FROM user where user=''; DELETE FROM user where user='root' and host='hostname'; GRANT ALL on *.* to root@"%" identified by 'hogehoge' with grant option; SET PASSWORD FOR root@127.0.0.1 = PASSWORD('hogehoge'); FLUSH PRIVILEGES; など。
未精査につき注意。
[client] #password = your_password port = 3306 socket = /tmp/mysql.sock [mysqld] ## IPアドレスバインドやポート指定など port = 3306 bind-address = xxx.xxx.xxx.xxx # ## 何はともあれ設定 socket = /tmp/mysql.sock # ## デフォルト文字コード設定 character-set-server = utf8 # ## 内蔵InnoDBは使わず、プラグインのInnoDBを使用する ignore-builtin-innodb plugin-load=innodb=ha_innodb_plugin.so # skip-external-locking #skip-locking key_buffer_size = 16M max_allowed_packet = 1M table_open_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M # ## ローカルでsocket通信しか行わないならアンコメント #skip-networking # ## SSLを有効にする(SSL Readyにするだけ) ssl # ## 実際には以下のパラメータが必要 #ssl_ca = #ssl_capath = #ssl_cert = #ssl_cipher = #ssl_key = # # Replication Master Server (default) log-bin=mysql-bin binlog_format=mixed server-id = 1 #master-host = #master-user = #master-password = #master-port = #master-connect-retry = #master-ssl = #master-ssl-ca = #master-ssl-capath = #master-ssl-cert = #master-ssl-cipher = #master-ssl-key = [mysqldump] skip-opt create-options default-character-set=binary hex-blob max_allowed_packet = 16M master-data quick set-charset single-transaction [mysql] no-auto-rehash # Remove the next comment character if you are not familiar with SQL #safe-updates [myisamchk] key_buffer_size = 20M sort_buffer_size = 20M read_buffer = 2M write_buffer = 2M [mysqlhotcopy] interactive-timeout