查看操作系统版本
所需软件:
cmake-2.8.7.tar.gz
mysql-5.5.23.tar.gz
CentOS-6.5-x86_64-bin-DVD1.iso
1.配置yum源
略
2 卸载系统自带的mysql
[root@MYSQL03 /]# yum remove mysql-libs-5.1.71-1.el6.x86_64
2.编译安装cmake
上面的错误是由于没有安装gcc编译器导致的,下面装gcc编译器
再次安装
还缺少安装gcc-c++编译器, 下面安装gcc-c++编译器
再次安装
到这里,cmake 已经安装完成
3. 添加mysql 用户
4. 创建数据存储目录
5. mysql编译安装
解决错误:
再次执行编译:
6. 生成mysql的配置文件
在my.cnf 中添加下面几个选项
7. 开始安装mysql
8. 启动mysql
9. 登陆mysql 修改密码
- [root@MYSQL03 /]# uname -a
- Linux MYSQL03 2.6.32-431.el6.x86_64 #1 SMP Fri Nov 22 03:15:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
- [root@MYSQL03 /]# cat /etc/redhat-release
- CentOS release 6.5 (Final)
cmake-2.8.7.tar.gz
mysql-5.5.23.tar.gz
CentOS-6.5-x86_64-bin-DVD1.iso
1.配置yum源
略
2 卸载系统自带的mysql
[root@MYSQL03 /]# yum remove mysql-libs-5.1.71-1.el6.x86_64
2.编译安装cmake
- [root@MYSQL03 ~]# tar zxvf cmake-2.8.7.tar.gz -C /usr/local/src/
- [root@MYSQL03 ~]# cd /usr/local/src/cmake-2.8.7/
- [root@MYSQL03 ~]#./configure
- ---------------------------------------------
CMake 2.8.7, Copyright 2000-2009 Kitware, Inc.
---------------------------------------------
Error when bootstrapping CMake:
Cannot find appropriate C compiler on this system.
Please specify one using environment variable CC.
See cmake_bootstrap.log for compilers attempted.
---------------------------------------------
Log of errors: /usr/local/src/cmake-2.8.7/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
- [root@MYSQL03 cmake-2.8.7]# yum install gcc
- [root@MYSQL03 cmake-2.8.7]# ./configure
- ---------------------------------------------
- CMake 2.8.7, Copyright 2000-2009 Kitware, Inc.
- C compiler on this system is: cc
- ---------------------------------------------
- Error when bootstrapping CMake:
- Cannot find appropriate C++ compiler on this system.
- Please specify one using environment variable CXX.
- See cmake_bootstrap.log for compilers attempted.
- ---------------------------------------------
- Log of errors: /usr/local/src/cmake-2.8.7/Bootstrap.cmk/cmake_bootstrap.log
- ---------------------------------------------
- [root@MYSQL03 cmake-2.8.7]# yum install gcc-c++
- [root@MYSQL03 cmake-2.8.7]# ./configure
- ......
- [root@MYSQL03 cmake-2.8.7]# gmake && make install
- .......
3. 添加mysql 用户
- [root@MYSQL03 home]# useradd -u 27 -d /home/mysql/ -s /sbin/nologin mysql
4. 创建数据存储目录
- [root@MYSQL03 home]# mkdir -p /data/mysql
- [root@MYSQL03 home]# mkdir /data/mysql/mysql_log
- [root@MYSQL03 home]# chown -R mysql:mysql /data/mysql/
- [root@MYSQL03 MYSQL]# tar zxvf mysql-5.5.23.tar.gz -C /usr/local/src/
- [root@MYSQL03 MYSQL]# cd /usr/local/src/mysql-5.5.23/
- [root@MYSQL03 mysql-5.5.23]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql/ -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=1333 -DDEFAULT_COLLATION=utf8_general_ci
-
- 报错
- .........
- CMake Error at cmake/readline.cmake:83 (MESSAGE):
- Curses library not found. Please install appropriate package,
-
- remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu, package name is libncurses5-dev, on Redhat and derivates it is ncurses-devel.
- Call Stack (most recent call first):
- cmake/readline.cmake:118 (FIND_CURSES)
- cmake/readline.cmake:214 (MYSQL_USE_BUNDLED_READLINE)
- CMakeLists.txt:268 (MYSQL_CHECK_READLINE)
- [root@MYSQL03 mysql-5.5.23]# yum install ncurses-devel
- [root@MYSQL03 mysql-5.5.23]# rm -f CMakeCache.txt
- [root@MYSQL03 mysql-5.5.23]# cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql -DDEFAULT_CHARSET=utf8 -DENABLED_LOCAL_INFILE=1 -DMYSQL_DATADIR=/data/mysql/ -DWITH_EXTRA_CHARSETS=all -DWITH_READLINE=1 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DMYSQL_TCP_PORT=1333 -DDEFAULT_COLLATION=utf8_general_ci
- [root@MYSQL03 mysql-5.5.23]# make && make install
- [root@MYSQL03 mysql-5.5.23]# cd /usr/local/mysql/support-files/
- [root@MYSQL03 support-files]# cp my-medium.cnf /etc/my.cnf
datadir = /data/mysql
skip-name-resolve
innodb_flush_log_at_trx_commit = 2
bind-address = 服务器内网网卡地址(重要:不要让他监听在0.0.0.0上)
lower_case_table_names=1
long_query_time=1
slow_query_log=1
并检查1333端口是否被占用7. 开始安装mysql
- [root@MYSQL03 support-files]# cd /usr/local/mysql/scripts/
- [root@MYSQL03 scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data/mysql/
-
- WARNING: The host 'MYSQL03' 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...
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:
/usr/local/mysql//bin/mysqladmin -u root password 'new-password'
/usr/local/mysql//bin/mysqladmin -u root -h 127.0.0.1
127.0.0.1 password 'new-password'
Alternatively you can run:
/usr/local/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 /usr/local/mysql/ ; /usr/local/mysql//bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql//mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/local/mysql//scripts/mysqlbug script!
- [root@MYSQL03 scripts]# cd /usr/local/mysql/support-files
- [root@MYSQL03 support-files]# cp mysql.server /etc/init.d/mysqld
- [root@MYSQL03 mysql]# vim /etc/profile
- 最后面加上
- export PATH=/usr/local/mysql/bin:$PATH
-
- [root@MYSQL03 mysql]# . /etc/profile
- [root@MYSQL03 mysql]# mysql
- Welcome to the MySQL monitor. Commands end with ; or \g.
- Your MySQL connection id is 1
- Server version: 5.5.23-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> select user,host,password from mysql.user;
- +------+-----------+----------+
- | user | host | password |
- +------+-----------+----------+
- | root | localhost | |
- | root | MYSQL03 | |
- | root | 127.0.0.1 | |
- | root | ::1 | |
- | | localhost | |
- | | MYSQL03 | |
- +------+-----------+----------+
- 6 rows in set (0.00 sec)
-
- mysql> update mysql.user set password=password('123456') where user='root';
- Query OK, 4 rows affected (0.00 sec)
- Rows matched: 4 Changed: 4 Warnings: 0
-
- mysql> delete from mysql.user where user='';
- Query OK, 2 rows affected (0.00 sec)
-
- mysql> flush privileges;
- Query OK, 0 rows affected (0.00 sec)
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/30150152/viewspace-1755695/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/30150152/viewspace-1755695/