Linux下编译安装MySQL5.1

来源:互联网 发布:什么软件打开psd 编辑:程序博客网 时间:2024/05/16 05:07

RHEL5 / OL5 / CentOS5 is OK!


[root@dbtest opt]# useradd mysql -s /sbin/nologin [root@dbtest opt]# mkdir -p /data/mysql /service[root@dbtest opt]# tar -zxvf mysql-5.1.65.tar.gz
[root@dbtest opt]# cd mysql-5.1.65[root@dbtest mysql-5.1.65]# ./configure  --prefix=/service/mysql --localstatedir=/data/mysql --sysconfdir=/data/mysql --with-mysqld-user=mysql --without-debug --with-big-tables --with-unix-socket-path=/data/mysql/mysql.sock --with-charset=utf8 --with-collation=utf8_general_ci --with-extra-charsets=all --with-tcp-port=30306 --with-plugins=partition,innobase --with-server-suffix=zhongwc_DB[root@dbtest mysql-5.1.65]# make && make install
[root@dbtest mysql-5.1.65]# cat support-files/my-large.cnf|grep -v ^# > /data/mysql/my.cnf[root@dbtest mysql-5.1.65]# /service/mysql/bin/mysql_install_db --defaults-file=/data/mysql/my.cnf  --basedir=/service/mysql --datadir=/data/mysql --user=mysqlInstalling MySQL system tables...121215  5:57:53 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.OKFilling help tables...121215  5:57:53 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/service/mysql/bin/mysqladmin -u root password 'new-password'/service/mysql/bin/mysqladmin -u root -h dbtest password 'new-password'Alternatively you can run:/service/mysql/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default.  This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:cd /service/mysql ; /service/mysql/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd /service/mysql/mysql-test ; perl mysql-test-run.plPlease report any problems with the /service/mysql/scripts/mysqlbug script![root@dbtest mysql-5.1.65]# /service/mysql/bin/mysqld_safe --defaults-file=/data/mysql/my.cnf --basedir=/service/mysql --datadir=/data/mysql --user=mysql &       [1] 16025[root@dbtest mysql-5.1.65]# 121215 05:58:40 mysqld_safe WARNING: Found /data/mysql/my.cnfThe data directory is a deprecated location for my.cnf, please move it to/service/mysql/my.cnf121215 05:58:40 mysqld_safe Logging to '/data/mysql/dbtest.err'.121215 05:58:40 mysqld_safe Starting mysqld daemon with databases from /data/mysql[root@dbtest mysql-5.1.65]# ll /data/mysqltotal 21300-rw-rw---- 1 mysql root      1442 Dec 15 05:58 dbtest.err-rw-rw---- 1 mysql mysql        6 Dec 15 05:58 dbtest.pid-rw-rw---- 1 mysql mysql 10485760 Dec 15 05:58 ibdata1-rw-rw---- 1 mysql mysql  5242880 Dec 15 05:58 ib_logfile0-rw-rw---- 1 mysql mysql  5242880 Dec 15 05:58 ib_logfile1-rw-r--r-- 1 root  root       622 Dec 15 05:56 my.cnfdrwx------ 2 mysql root      4096 Dec 15 05:57 mysql-rw-rw---- 1 mysql mysql    19081 Dec 15 05:57 mysql-bin.000001-rw-rw---- 1 mysql mysql   742530 Dec 15 05:57 mysql-bin.000002-rw-rw---- 1 mysql mysql      106 Dec 15 05:58 mysql-bin.000003-rw-rw---- 1 mysql mysql       57 Dec 15 05:58 mysql-bin.indexsrwxrwxrwx 1 mysql mysql        0 Dec 15 05:58 mysql.sockdrwx------ 2 mysql root      4096 Dec 15 05:57 test[root@dbtest mysql-5.1.65]# /service/mysql/bin/mysqladmin  -uroot password '123456'[root@dbtest mysql-5.1.65]# /service/mysql/bin/mysqladmin shutdown -uroot -pEnter password: 121215 05:59:30 mysqld_safe mysqld from pid file /data/mysql/dbtest.pid ended[1]+  Done                    /service/mysql/bin/mysqld_safe --defaults-file=/data/mysql/my.cnf --basedir=/service/mysql --datadir=/data/mysql --user=mysql[root@dbtest mysql-5.1.65]# /service/mysql/bin/mysqld_safe --defaults-file=/data/mysql/my.cnf --basedir=/service/mysql --datadir=/data/mysql --user=mysql 2>&1 > /dev/null &[1] 16156[root@dbtest mysql-5.1.65]# 121215 05:59:48 mysqld_safe WARNING: Found /data/mysql/my.cnfThe data directory is a deprecated location for my.cnf, please move it to/service/mysql/my.cnf[root@dbtest mysql-5.1.65]# /service/mysql/bin/mysql -uroot -pEnter password: Welcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.1.65zhongwc_DB-log Source distributionCopyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show engines;+------------+---------+------------------------------------------------------------+--------------+------+------------+| Engine     | Support | Comment                                                    | Transactions | XA   | Savepoints |+------------+---------+------------------------------------------------------------+--------------+------+------------+| MRG_MYISAM | YES     | Collection of identical MyISAM tables                      | NO           | NO   | NO         || CSV        | YES     | CSV storage engine                                         | NO           | NO   | NO         || MyISAM     | DEFAULT | Default engine as of MySQL 3.23 with great performance     | NO           | NO   | NO         || InnoDB     | YES     | Supports transactions, row-level locking, and foreign keys | YES          | YES  | YES        || MEMORY     | YES     | Hash based, stored in memory, useful for temporary tables  | NO           | NO   | NO         |+------------+---------+------------------------------------------------------------+--------------+------+------------+5 rows in set (0.00 sec)mysql> show variables like '%set%';+--------------------------+--------------------------------------+| Variable_name            | Value                                |+--------------------------+--------------------------------------+| auto_increment_offset    | 1                                    || character_set_client     | utf8                                 || character_set_connection | utf8                                 || character_set_database   | utf8                                 || character_set_filesystem | binary                               || character_set_results    | utf8                                 || character_set_server     | utf8                                 || character_set_system     | utf8                                 || character_sets_dir       | /service/mysql/share/mysql/charsets/ |+--------------------------+--------------------------------------+9 rows in set (0.00 sec)mysql> show variables like '%port%';+---------------------+-------+| Variable_name       | Value |+---------------------+-------+| innodb_support_xa   | ON    || large_files_support | ON    || port                | 30306 || report_host         |       || report_password     |       || report_port         | 30306 || report_user         |       |+---------------------+-------+7 rows in set (0.00 sec)mysql> show variables like '%scok%';Empty set (0.00 sec)mysql> show variables like '%sock%';+---------------+------------------------+| Variable_name | Value                  |+---------------+------------------------+| socket        | /data/mysql/mysql.sock |+---------------+------------------------+1 row in set (0.00 sec)mysql> 



原创粉丝点击