MySQL 5.0.9のソースコードをダウンロードし、rootユーザーとしてビルドしてインストールしました。
./configure
./make
./make install
今、私はmysqldを起動しようとしていますが、エラーは次のようになります。
[root libexec]# ./mysqld
120718 7:37:09 [ERROR] Fatal error: Can't change to run as user 'mysql' ; Please check that the user exists!
120718 7:37:09 [ERROR] Aborting
120718 7:37:09 [Note] ./mysqld: Shutdown complete
[root libexec]#
私はrootユーザーとしてすべてのアクティビティを実行し、初めてサービスを開始しようとしていることに注意してください。
user868766が以下に示すことを実行しましたが、最後のコマンドを正常に実行できませんでした。しかし今、私はそれを直接呼び出そうとしている間に何か他のものを手に入れます:
ところで、MySQLのルートパスワードをどのように設定しますか?
[root libexec]# ./mysqld
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
120718 7:52:35 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
120718 7:52:35 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
120718 7:52:35 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
120718 7:52:35 InnoDB: Started; log sequence number 0 0
120718 7:52:35 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
user868766によって提供されたリンクにある情報に従って実行しました:
[root bin]# mysql_install_db
それ以外のコマンドを使用すると問題が発生することに注意してください。
[root bin]# mysql_install_db -user=mysql -ldata=/opt/mysql/mysql/data
Installing MySQL system tables...
120718 8:35:00 [Warning] Ignoring user change to 'ser=mysql' because the user was set to 'mysql' earlier on the command line
120718 8:35:00 [Warning] Ignoring user change to 'ser=mysql' because the user was set to 'mysql' earlier on the command line
/usr/local/libexec/mysqld: File 'data=/opt/mysql/mysql/data' not found (Errcode: 2)
120718 8:35:00 [ERROR] Could not use data=/opt/mysql/mysql/data for logging (error 2). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.
OK
Filling help tables...
120718 8:35:00 [Warning] Ignoring user change to 'ser=mysql' because the user was set to 'mysql' earlier on the command line
120718 8:35:00 [Warning] Ignoring user change to 'ser=mysql' because the user was set to 'mysql' earlier on the command line
/usr/local/libexec/mysqld: File 'data=/opt/mysql/mysql/data' not found (Errcode: 2)
120718 8:35:00 [ERROR] Could not use data=/opt/mysql/mysql/data for logging (error 2). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.
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 idc-bldtool01 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 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 on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[root bin]# ls -l /opt/mysql/mysql/data
total 0
ただし、この後、mysqldを起動できます。
[root libexec]# ./mysqld
InnoDB: Log scan progressed past the checkpoint lsn 0 36808
120718 8:37:22 InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 0 43655
120718 8:37:22 InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
InnoDB: Apply batch completed
120718 8:37:23 InnoDB: Started; log sequence number 0 43655
120718 8:37:23 [Note] ./mysqld: ready for connections.
Version: '5.0.91' socket: '/var/lib/mysql/mysql.sock' port: 3306 Source distribution
今、私は上記のコンソールダンプのヒントとしてrootパスワードを設定しようとしています:
[root~]# /usr/local/bin/mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
Enter current password for root (enter for none):
Aborting!
Cleaning up...
問題を解決するにはどうすればよいですか?
user868766のおかげで、私はなんとか解決し、mysqlを起動して接続することができました。