#zhxia #qq:252578390 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
yum install bison
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
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
default-storage-engine=MyISAM
user = mysql
初始化数据库
/usr/local/usr/mysql/scripts/mysql_install_db --basedir=/usr/local/usr/mysql --datadir=/data/mysql --user=mysql
启动MySQL
service mysql start
初始化root密码
/usr/local/platform/mysql/bin/mysqladmin -u root password 新密码