java技术研究

统计

留言簿(3)

阅读排行榜

评论排行榜

MYSQL 5.5的编译安装全过程

mysql:http:x//mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.14.tar.gz

cmake:http://www.cmake.org/cmake/resources/software.html

 

首先要安装cmake
#tar zxf cmake-2.8.5.tar.gz 
#cd cmake-2.8.5 
#./bootstrap 
#make 
#make install 

 

依据源码安装mysql
useradd mysql 
tar zxf mysql-5.5.14.tar.g 
cd mysql-5.5.14 
CFLAGS="-O3" CXX=gcc
CXXFLAGS="-O3 -felide-constructors -fno-exceptions -fno-rtti"
cmake . -LH|more //CMake下查看MySQL的编译配置 


/usr/local/bin/cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql \
-DMYSQL_UNIX_ADDR=/opt/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_EXTRA_CHARSETS=all \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/opt/mysql/data \
-DMYSQL_TCP_PORT=3306 \


make; make install
cd /opt
chown -R mysql:mysql mysql
cd /opt/mysql
chmod 777 data
./scripts/mysql_install_db

./scripts/mysql_install_db --user=mysql --datadir=/opt/mysql/data

update mysql.user set password=PASSWORD('1234') where User='root';
flush privileges;

 

show variables like 'character_set_%'; 字符集查看

redhat需要装的库
yum -y install patch make gcc gcc-c++ gcc-g77 flex bison file
yum -y install libtool libtool-libs autoconf kernel-devel
yum -y install libjpeg libjpeg-devel libpng libpng-devel libpng10 libpng10-devel gd gd-devel
yum -y install freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel
yum -y install glib2 glib2-devel bzip2 bzip2-devel libevent libevent-devel
yum -y install ncurses ncurses-devel curl curl-devel e2fsprogs
yum -y install e2fsprogs-devel krb5 krb5-devel libidn libidn-devel
yum -y install openssl openssl-devel vim-minimal nano sendmail
yum -y install fonts-chinese gettext gettext-devel
yum -y install ncurses-devel
yum -y install gmp-devel pspell-devel
yum -y install unzip
注意:如果忘记先安装库,在cmake的时候报错了,得先把库安装一遍,然后删除/opt/mysql-5.6.21/CMakeCache.txt重新cmake一遍就行了.


mysql刚刚装好root初始密码是空的,直接回车就行了

修改授权以便远程机器能够访问
在安装mysql的机器上运行:

1、d:\mysql\bin\>mysql -h localhost -u root //这样应该可以进入MySQL服务器

2、mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION //赋予任何主机访问数据的权限

3、mysql>FLUSH PRIVILEGES //修改生效

4、mysql>EXIT //退出MySQL服务器

 

posted on 2013-06-27 17:15 小秦 阅读(225) 评论(0)  编辑  收藏


只有注册用户登录后才能发表评论。


网站导航: