2014-07-13 16:20:52
来 源
中存储网
MySQL
由于开发需要,现在需要安装安装MySQL5.5.9,使用了rpm安装总是出错,而且还有好多依事关系麻烦,此外也没有找到二进制的包,只好找源码包进行编译;[root@linuxidc www.linuxidc.com]# uname -aLinux test 2

由于开发需要,现在需要安装安装MySQL 5.5.9,使用了rpm安装总是出错,而且还有好多依事关系麻烦,此外也没有找到二进制的包,只好找源码包进行编译;

[root@linuxidc www.linuxidc.com]# uname -a
Linux test 2.6.18-194.el5 #1 SMP Fri Apr 2 14:58:14 EDT 2010 x86_64 x86_64 x86_64 GNU/Linux

首先,需要下载安装Cmake;
wget http://www.cmake.org/files/v2.8/cmake-2.8.4.tar.gz
安装cmake;
tar xvzf cmake-2.8.4.tar.gz
./configure
make
make install
下载mysql,可以去官方网站找到你所需要的;
wget ftp://mirror.switch.ch/mirror/mysql/Downloads/MySQL-5.5/mysql-5.5.9.tar.gz
编译安装mysql
cd mysql5.5.9
rm CMakeCache.txt
cmake .
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql/
-DMYSQL_DATADIR=/usr/local/mysql/data
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DMYSQL_TCP_PORT=3306
-DMYSQL_UNIX_ADDR=/usr/local/mysql/data/mysql.sock
-DMYSQL_USER=mysql
-DWITH_DEBUG=0
我在编译的时候报错,意思是DMYSQL_USER=mysql无效,懒得找原因,直接把那个参数给去掉了,接着进行下面的操作;
make && make install

完成后进入MYSQL安装目录

cd /usr/local/mysql
cp support-files/my-huge.cnf /etc/my.cnf
vi /etc/my.cnf

将数据目录和套接字文件修改为你自己设定的路径值,我几乎没有改.

现在需要更改权限;
chown mysql:mysql /etc/my.cnf
chown -R mysql:mysql /usr/local/mysql

切换用户进入安装目录
su – mysql
cd /usr/local/mysql/scripts
./mysql_install_db

启动MYSQL
bin/mysqld_safe &

查看端口;
[root@linuxidc www.linuxidc.com]# netstat -an | grep 3306
tcp        0      0 :::3306                     :::*                        LISTEN     
[root@linuxidc www.linuxidc.com]# ps aux | grep mysql | grep -v 'grep'
mysql    15747  0.0  0.0  63828  1268 pts/3    S    11:03   0:00 /bin/sh ./mysqld_safe
mysql    15985  0.0  5.5 765088 114340 pts/3   Sl   11:03   0:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --log-error=/usr/local/mysql/data/test.err --pid-file=/usr/local/mysql/data/bailianweb64.pid --socket=/usr/local/mysql/data/mysql.sock --port=3306
root     16031  0.0  0.1  92996  2416 pts/4    S+   11:06   0:00 ./mysql

如下进行phpmyadmin 设置,此处略去一万字……

OK,到此操作结束!

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 localhost.localdomain 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!

声明: 此文观点不代表本站立场;转载须要保留原文链接;版权疑问请联系我们。