安裝mysql壓縮包記錄 安裝mysql記錄 [root@eegooserver3 ~]# groupadd mysql [root@eegooserver3 ~]# useradd -g mysql mysql [root@eegooserver3 ~]# cd /opt [root@eegooserver3 opt]# tar zxvf mysql-5.1.63-linux-x86_64-glibc23.tar.gz [root@eegooserver3 opt]# mv /opt/mysql-5.1.63-linux-x86_64-glibc23 /usr/local/mysql [root@eegooserver3 opt]# cd /usr/local/mysql/ [root@eegooserver3 mysql]# ll total 76 drwxr-xr-x. 2 7155 wheel 4096 Apr 16 16:57 bin -rw-r--r--. 1 7155 wheel 17987 Apr 16 16:57 COPYING drwxr-x---. 4 7155 wheel 4096 Apr 16 16:57 data drwxr-xr-x. 2 7155 wheel 4096 Apr 16 16:54 docs drwxr-xr-x. 2 7155 wheel 4096 Apr 16 16:54 include -rw-r--r--. 1 7155 wheel 7605 Apr 16 16:57 INSTALL-BINARY drwxr-xr-x. 3 7155 wheel 4096 Apr 16 16:57 lib drwxr-xr-x. 4 7155 wheel 4096 Apr 16 16:55 man drwxr-xr-x. 10 7155 wheel 4096 Apr 16 16:57 mysql-test -rw-r--r--. 1 7155 wheel 2552 Apr 16 16:57 README drwxr-xr-x. 2 7155 wheel 4096 Apr 16 16:57 scripts drwxr-xr-x. 27 7155 wheel 4096 Apr 16 16:57 share drwxr-xr-x. 5 7155 wheel 4096 Apr 16 16:57 sql-bench drwxr-xr-x. 2 7155 wheel 4096 Apr 16 16:57 support-files [root@eegooserver3 mysql]# chown -R mysql . [root@eegooserver3 mysql]# chgrp -R mysql . [root@eegooserver3 mysql]# cp support-files/my-huge.cnf /etc/my.cnf [root@eegooserver3 mysql]# scripts/mysql_install_db --user=mysql 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: ./bin/mysqladmin -u root password 'new-password' ./bin/mysqladmin -u root -h eegooserver3 password 'new-password' Alternatively you can run: ./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 . ; ./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 ./bin/mysqlbug script! [root@eegooserver3 mysql]# chown -R root . [root@eegooserver3 mysql]# chown -R mysql data [root@eegooserver3 mysql]# ln -s /usr/local/mysql/bin/mysqld_safe /usr/local/bin [root@eegooserver3 mysql]# ln -s /usr/local/mysql/bin/mysql /usr/local/bin [root@eegooserver3 mysql]# ln -s /usr/local/mysql/bin/mysqldump /usr/local/bin [root@eegooserver3 mysql]# bin/mysqld_safe --user=mysql & [1] 5425 [root@eegooserver3 mysql]# 120827 22:43:45 mysqld_safe Logging to '/usr/local/mysql/data/eegooserver3.err'. 120827 22:43:45 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data ^C [root@eegooserver3 mysql]# /usr/local/mysql/bin/mysqladmin -u root password 123456 [root@eegooserver3 mysql]# mysql -u root -p Enter password: 123456 Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.1.63-log MySQL Community Server (GPL) Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> select user,host,password from mysql.user; +------+--------------+----------+ | user | host | password | +------+--------------+----------+ | root | localhost | | | root | eegooserver3 | | | root | 127.0.0.1 | | | | localhost | | | | eegooserver3 | | +------+--------------+----------+ 5 rows in set (0.00 sec) mysql> grant all on *.* to root@'%' identified by '123456'; Query OK, 0 rows affected (0.00 sec) mysql> flush privileges; Query OK, 0 rows affected (0.00 sec) mysql> exit; Bye [root@eegooserver3 mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld [root@eegooserver3 mysql]# chmod 700 /etc/init.d/mysqld [root@eegooserver3 mysql]#chkconfig --add mysqld [root@eegooserver3 mysql]# chkconfig --level 345 mysqld on [root@eegooserver3 mysql]# chkconfig --list mysqld