Mysql学习Centos5.5中安装Mysql5.5过程分享
《Mysql学习Centos5.5中安装Mysql5.5过程分享》要点: 这几天在centos下装mysql,这里记录一下安装的过程,便利以后查阅MYSQL必读 Mysql5.5.37安装必要cmake,5.6版本开始都必要cmake来编译,5.5以后的版本应该也要装这个.MYSQL必读 安装cmakeMYSQL必读 代码如下:[root@local ~]# wget http://www.cmake.org/files/v2.8/cmake-2.8.12.2.tar.gz [root@local ~]# tar xvf cmake-2.8.12.2.tar.gz [root@local ~]# cd cmake-2.8.12.2 [root@local cmake-2.8.12.2]#./bootstrap [root@local cmake-2.8.12.2]# make [root@local cmake-2.8.12.2]# make install 安装mysqlMYSQL必读 代码如下:[root@local ~]# wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.37.tar.gz [root@local ~]# tar xvf mysql-5.5.37.tar.gz [root@local ~]# cd mysql-5.5.37 [root@local mysql-5.5.37]# cmake ./ 可能还会报这个错,没有就跳过 MYSQL必读 代码如下:CMake Error at cmake/readline.cmake:83(MESSAGE): Curses library not found.? Pleaseinstall appropriate package, remove CMakeCache.txt and rerun cmake.On Debian/Ubuntu,package name islibncurses5-dev,on Redhat and derivates it is ncurses-devel. Call Stack (most recent call first): ?cmake/readline.cmake:127 (FIND_CURSES) ?cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT) ?CMakeLists.txt:355 (MYSQL_CHECK_READLINE -- Configuring incomplete,errors occurred! See also "/root/my/mysql-5.5.37/CMakeFiles/CMakeOutput.log". See also"/root/my/mysql-5.5.37/CMakeFiles/CMakeError.log". 阐明centos系统没有ncurses-develMYSQL必读 代码如下:[root@local ~]# wget http://invisible-island.net/datafiles/release/ncurses.tar.gz [root@local ~]# cd ncurses-5.9 [root@local ncurses-5.9]#./configure [root@local ncurses-5.9]# make [root@local ncurses-5.9]# make install 再删除刚才编译生成的 CMakeCache.txt 文件,不然无法进行下一步MYSQL必读 代码如下:[root@local mysql-5.5.37]# rm -f CMakeCache.txt 继续编译mysqlMYSQL必读 代码如下:[root@local ~]# cmake ./ [root@local ~]# make [root@local ~]# make install 这样,mysql默认将胜利安装到/usr/local/mysqlMYSQL必读 创立mysql用户组MYSQL必读 代码如下:[root@local ~]# groupadd mysql [root@local ~]# useradd Cr Cg mysql mysql [root@local ~]# chown CR mysql.mysql /usr/local/mysql 启动mysqlMYSQL必读 代码如下:[root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql? 这里可能会发生差错,没有就跳过:MYSQL必读 代码如下:FATAL ERROR: Could not find./bin/my_print_defaults If you compiled from source,you need torun 'make install' to copy the software into the correct locationready for operation. If you are using a binary release,you musteither be at the top level of the extracted archive,or pass the --basedir option pointing to that location. 解决办法:MYSQL必读 代码如下:[root@local ~]# /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data 再启动mysqlMYSQL必读 代码如下:[root@local ~]# /usr/local/mysql/bin/mysqld_safe --user=mysql 注册mysql服务,开机主动启动MYSQL必读 1.设置mysql配置文件到/etc目次MYSQL必读 代码如下:[root@local ~]# cp /usr/local/mysql/support-files/my-medium.cnf/etc/my.cnf? 2.设置mysql开机自启MYSQL必读 代码如下:[root@local ~]# cp/usr/local/mysql/support-files/mysql.server /etc/init.d/mysql [root@local ~]# chmod +x /etc/init.d/mysql [root@local ~]# /sbin/chkconfig --add mysql 3.启动mysql服务MYSQL必读 代码如下:[root@local ~]# service mysql start? 测试mysql是否安装胜利MYSQL必读 代码如下:[root@local ~]# /usr/local/mysql/bin/mysql -u root -p? Enter password:?? Welcome to the MySQL monitor.? Co妹妹ands end with ; or g.? Your MySQL connection id is 1? Server version: 5.5.37 Source distribution? ?? Copyright (c) 2000,2014,Oracle and/or itsaffiliates. All rights reserved.? ?? Oracle is a registered trademark of OracleCorporation and/or its? affiliates. Other names may be trademarksof their respective? owners.? ?? Type 'help;' or 'h' for help. Type 'c' toclear the current input statement.? ?? mysql> show databases;? +--------------------+? | Database?????????? |? +--------------------+? | information_schema |? | mysql????????????? |? | performance_schema |? | test?????????????? |? +--------------------+? 4 rows in set (0.03 sec)? 《Mysql学习Centos5.5中安装Mysql5.5过程分享》是否对您有启发,欢迎查看更多与《Mysql学习Centos5.5中安装Mysql5.5过程分享》相关教程,学精学透。编程之家PHP学院为您提供精彩教程。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |