linux-mysql的编译安装2

环境: Red Hat Enterprise Linux Server release 6.2 (Santiago)
内核: 2.6.32-220.el6.x86_64
Mysql版本: mysql-5.1.62
mysql文件存放目录:/home/software/lamp/
安装目录:/lamp/mysql

先添加mysql用户:

 

[root@A12 mysql]#useradd mysql –s /sbin/nologin

 

[root@A12 network-scripts]# grep mysql /etc/passwd
mysql:x:501:501::/home/mysql:/sbin/nologin

编译mysql参数
[root@A12 mysql-5.1.62]# ./configure
--prefix=/lamp/mysql
--with-unix-socket-path=/lamp/mysql/tmp/mysql.sock \
--localstatedir=/lamp /mysql/data \
--enable-assembler \
--enable-thread-safe-client \
--with-mysqld-user=mysql \
--with-big-tables \
--with-debug \
--with-pthread \
--with-extra-charsets=complex \
--with-readline \
--with-ssl \
--with-embedded-server \
--enable-local-infile \
--with-plugins=partition,innobase \
--with-plugin-PLUGIN \
--with-mysqld-ldflags=-all-static \
--with-client-ldflags=-all-static \


[root@A12 mysql-5.1.62]# make
[root@A12 mysql-5.1.62]# make install

编译出错提示:
checking for termcap functions library... configure: error: No curses/termcap library found
安装下列两个文件后正常
ncurses-5.8-2.20110319.fc15.x86_64
ncurses-devel.x86_64 0:5.8-2.20110319.fc15


主配文件的配置
[root@A12 mysql-5.1.62]# cd support-files/
[root@A12 support-files]# ll *.cnf
-rw-r--r--. 1 root root 4714 Apr 17 17:37 my-huge.cnf
-rw-r--r--. 1 root root 19763 Apr 17 17:37 my-innodb-heavy-4G.cnf
-rw-r--r--. 1 root root 4688 Apr 17 17:37 my-large.cnf
-rw-r--r--. 1 root root 4699 Apr 17 17:37 my-medium.cnf
-rw-r--r--. 1 root root 2467 Apr 17 17:37 my-small.cnf

复制主配文件
[root@A12 support-files]# /bin/cp my-huge.cnf /etc/my.cnf

配置 mysql的启动脚 本,以便 于管理:
[root@A12 support-files]# /bin/cp mysql.server /etc/init.d/mysqld
[root@A12 support-files]# ll /etc/init.d/mysqld
-rw-r--r--. 1 root root 12273 Apr 18 11:03 /etc/init.d/mysqld

[root@A12 support-files]# chmod 755 /etc/init.d/mysqld
[root@A12 support-files]# /etc/init.d/mysqld restart
Shutting down MySQL.120418 11:05:44 mysqld_safe mysqld from pid file /lamp/mysql/data/A12.loading.com.pid ended  [ OK ]
Starting MySQL. [ OK ]
[1]+ Done /lamp/mysql/bin/mysqld_safe (wd: /lamp/mysql/bin)
(wd now: /home/software/lamp/mysql-5.1.62/support-files)

[root@A12 support-files]# netstat -lntup |grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 32363/mysqld


创建目录:
[root@A12 support-files]# cd /lamp/mysql/
[root@A12 mysql]# mkdir data
[root@A12 mysql]# chown -R mysql.mysql /lamp/mysql
[root@A12 mysql]# cd bin/
[root@A12 bin]# ./mysql_install_db --user=mysql
WARNING: The host 'A12.loading.com' could not be looked up with resolveip.
This probably means that your libc libraries are not 100 % compatible
with this binary MySQL version. The MySQL daemon, mysqld, should work
normally with the exception that host name resolving will not work.
This means that you should use IP addresses instead of hostnames
when specifying MySQL privileges !
Installing MySQL system tables...
120418 10:49:48 [Warning] '--skip-locking' is deprecated and will be removed in a future release. Please use '--skip-external-locking' instead.
OK
Filling help tables...
120418 10:49:50 [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:

/lamp/mysql/bin/mysqladmin -u root password 'new-password'
/lamp/mysql/bin/mysqladmin -u root -h A12.loading.com password 'new-password'

Alternatively you can run:
/lamp/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 /lamp/mysql ; /lamp/mysql/bin/mysqld_safe &

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

Please report any problems with the /lamp/mysql/bin/mysqlbug script!

[root@A12 bin]# /lamp/mysql/bin/mysqld_safe &
[root@A12 bin]# netstat -lntup |grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 32153/mysqld

[root@A12 bin]# echo 'export PATH=$PATH:/lamp/mysql/bin' >> /etc/profile
[root@A12 bin]# source /etc/profile


[root@A12 support-files]# mysql -uroot
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.62-debug-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 databases ;

+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)

你可能感兴趣的:(MySQL的安装)