编译安装mysql5.5,步骤如下。
首先,编译代码:
复制代码 代码示例:
#modify by www.jb200.com
#date 2013/6/20
cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql
-DMYSQL_DATADIR=/home/mysql/3306/data
-DDEFAULT_CHARSET=utf8
-DWITH_READLINE=1
-DWITH_SSL=system
-DWITH_EMBEDDED_SERVER=1
-DENABLED_LOCAL_INFILE=1
-DDEFAULT_COLLATION=utf8_general_ci
-DWITH_
myisam_STORAGE_ENGINE=1
-DWITH_INNOBASE_STORAGE_ENGINE=1
-DWITH_MEMORY_STORAGE_ENGINE=1
-DWITH_DEBUG=0
可能遇到的问题,发下:
出现: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.
出现:Warning: Bison executable not found in PATH
解决办法:
开始安装:
复制代码 代码示例:
make && make install
复制相关文件,并给予权限:
复制代码 代码示例:
cp support-files/my-medium.cnf /usr/local/mysql/my.cnf
chmod +x /usr/local/mysql
chown -R mysql.mysql /usr/local/mysql
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
chmod +x /etc/init.d/mysql
chkconfig --level 2345 mysql on
修改配置文件
vim /usr/local/usr/mysql/my.cnf
在mysqld下加入:
复制代码 代码示例:
datadir=/data/mysqldata
default-storage-engine=MyISAM
user = mysql
初始化数据库
复制代码 代码示例:
/usr/local/usr/mysql/scripts/mysql_install_db --ba
sedir=/usr/local/usr/mysql --datadir=/data/mysql --user=mysql
启动MySQL
复制代码 代码示例:
service mysql start
初始化root密码
复制代码 代码示例:
/usr/local/platform/mysql/bin/mysqladmin -u root password 新密码
很简单,轻松几步就完成了mysql5.5的安装,希望对大家有所帮助。