Linux下编译安装MySQL5.1

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=mysql
Installing 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.
OK
Filling 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.
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:

/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_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 /service/mysql ; /service/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /service/mysql/mysql-test ; perl mysql-test-run.pl

Please 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.cnf
The data directory is a deprecated location for my.cnf, please move it to
/service/mysql/my.cnf
121215 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/mysql
total 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.cnf
drwx------ 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.index
srwxrwxrwx 1 mysql mysql        0 Dec 15 05:58 mysql.sock
drwx------ 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 -p
Enter 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.cnf
The 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 -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.65zhongwc_DB-log Source distribution

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> 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> 



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值