分类目录归档:MySQL安装配置

mysql 5.5 源码安装

1.安装cmake
1)下载cmake
#wget http://www.cmake.org/files/v2.8/cmake-2.8.3.tar.gz
2)解压cmake
#tar -zvxf cmake-2.8.3.tar.gz
3)配置编译
#cd cmake-2.8.3
#yum -y install gcc
#yum -y install gcc-c++
#./configure
#make
#make install

2.安装MYSQL
1)下载MYSQL
mkdir /opt/mysql_src
#cd /opt/mysql_src
#wget http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.14.tar.gz/from/http://mysql.mirror.rafal.ca/
2)解压mysql-5.5.14.tar.gz
#tar -zvxf mysql-5.5.14.tar.gz

创建目录(mysql5.5默认已经没有data目录了)
mkdir -p /opt/mysql_src/product
mkdir -p /opt/mysql_src/data

3)配置编译
#cd mysql-5.5.14
#cmake . ##这个方法,安装路径默认

#cmake . \
-DCMAKE_BUILD_TYPE:STRING=Release \
-DCMAKE_INSTALL_PREFIX:PATH=/opt/mysql_src/product \
-DCOMMUNITY_BUILD:BOOL=ON \
-DENABLED_PROFILING:BOOL=ON \
-DENABLE_DEBUG_SYNC:BOOL=OFF \
-DINSTALL_LAYOUT:STRING=STANDALONE \
-DMYSQL_DATADIR:PATH=/opt/mysql_src/data \
-DMYSQL_MAINTAINER_MODE:BOOL=OFF \
-DWITH_EMBEDDED_SERVER:BOOL=ON \
-DWITH_EXTRA_CHARSETS:STRING=all \
-DWITH_SSL:STRING=bundled \
-DWITH_UNIT_TESTS:BOOL=OFF \
-DWITH_ZLIB:STRING=bundled \
-LH

如果出现一下错误:
cmake .
– MySQL 5.5.14
– Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:82 (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:126 (FIND_CURSES)
cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:256 (MYSQL_CHECK_READLINE)

– Configuring incomplete, errors occurred!

需要安装ncurses-devel包
# yum -y install ncurses-devel

#make
#make install

#groupadd mysql
#useradd -r -g mysql mysql
#cd /opt/mysql_sc
#chown -R mysql:mysql .
#scripts/mysql_install_db –user=mysql
添加标准/etc/my.cnf文件(见mysql二进制安装程序,修改相关路径)
#./bin/mysqld_safe –user=mysql &

发表在 MySQL安装配置 | 一条评论

mysql 二进制文件安装注意事项

执行mysql_secure_installation报错
错误现象:
Enter current password for root (enter for none):
ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’ (2)
错误原因:
mysql_secure_installation ignores –socket
解决方案:
1)ln -s /var/run/mysqld/mysqld.sock /tmp/mysql.sock
2)修改mysql_secure_installation 脚本的do_query 函数(推荐处理方法)
do_query() {
echo “$1″ >$command
#sed ‘s,^,> ,’ < $command # Debugging # mysql --defaults-file=$config <$command ----此行修改如下: mysql --defaults-extra-file=$config <$command return $? } 使用mysqld_safe启动msql错误
mysqld_safe启动报错

注意:如果想把错误日志放到专门的日志目录中,需要在my.cnf中添加log-error=path选项
mysql二进制文件安装指导和my.cnf文件

发表在 MySQL安装配置 | 评论关闭

mysqld_safe启动报错

使用二进制编译文件的mysqld_safe启动报错,如下:
[mysql@ECP-UC-DB1 ~]$ mysqld_safe
110707 21:31:19 mysqld_safe Logging to ‘/opt/mysql/mysqldata/ECP-UC-DB1.err’.
110707 21:31:19 mysqld_safe The file /usr/local/mysql/bin/mysqld
does not exist or is not executable. Please cd to the mysql installation
directory and restart this script from there as follows:
./bin/mysqld_safe&
See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information

解决方法:
su – root
mkdir /usr/local/mysql/bin
ln -s /opt/mysql/product/5.5/bin/mysqld /usr/local/mysql/bin/mysqld

再次执行mysqld_safe
[mysql@ECP-UC-DB1 ~]$ mysqld_safe
110707 21:32:37 mysqld_safe Logging to ‘/opt/mysql/mysqldata/ECP-UC-DB1.err’.
110707 21:32:37 mysqld_safe Starting mysqld daemon with databases from /opt/mysql/mysqldata

启动结果:
mysql 26885 23452 0 21:32 pts/0 00:00:00 /bin/sh /opt/mysql/product/5.5/bin/mysqld_safe
mysql 27653 26885 0 21:32 pts/0 00:00:00 /usr/local/mysql/bin/mysqld –basedir=/opt/mysql/product/5.5 –datadir=/opt/mysql/mysqldata –plugin-dir=/usr/local/mysql/lib/plugin –log-error=/opt/mysql/mysqldata/ECP-UC-DB1.err –open-files-limit=8192 –pid-file=/var/run/mysqld/mysqld.pid –socket=/var/run/mysqld/mysqld.sock –port=3306

问题存在原因:
1、mysqld_safe只认识/usr/local/mysql/bin/mysqld(也许是配置问题)
2、my.cnf只能放置在/etc/下面,不然使用–defaults-file也不能读取my.cnf文件(有疑惑)

发表在 MySQL安装配置 | 评论关闭