Preface: The MySQL database has been installed using the CMake Compilation tool since version 5.5.
Installation Environment:
[Email protected] ~]# cat/etc/redhat-release
Red Hat Enterprise Linux Server release 6.5 (Santiago)
[Email protected] ~]# mysqladmin--version
Mysqladmin Ver 8.42 distrib 5.6.14, for Linux on x86_64
1. Install the CMake source package (it is already installed, skip this step)
#如果系统中无cmake命令, you will need to download and install the CMake installation package
[Email protected]]# cmake--version
-bash:cmake:command not found
[[email protected]] #Wget
Http://wwwNaNake.org/files/v2.8/cmake-2.8.10.2.tar.gz--no-check-certificate//Download CMake source Package
[[Email protected]]# tar-zxvf cmake-2.8.10.2.tar.gz//Unzip the installation package
[[Email protected]]# CD cmake-2.8.10.2//Enter unzip directory
[[Email protected]]#./bootstrap//Execute
[[Email protected]]# gmake//compile]
[[Email protected]]# gmake Install//installation
[[Email protected] ~] #cmake--version//verification installation
CMake version2.8.10.2
2. Download the MySQL installation media
#可到mysql网站进行下载相关版本并上传至服务器
http://www.mysql.com/
http://download.csdn.net/detail/sunny_sailor/8072429
3. Create MySQL Users and groups
#创建安装mysql所需要的用户及组
[[Email protected] ~] #groupaddmysql
[[Email protected] ~] #useradd-R-G MySQL MySQL
4. Install the necessary packages
#可配置本地或者互联网yum进行安装
[Email protected] ~]# yum-y install gcc gcc-c++ gcc-g77 autoconfautomake zlib* fiex* libxml* ncurses-devel libmcrypt* li Btool-ltdl
5. Compile and install MySQL
#此步骤为cmake方式编译安装mysql
[[Email protected] ~] #tar-xf mysql-5.6.14.tar.gz #解压
[[Email protected] ~] #cdmysql -5.6.14 #进入解压目录
[Email protected]]# cmake. -dcmake_install_prefix=/application/mysql-dmysql_datadir=/application/mysql/data-dsysconfdir=/etc/mysql-dwith_ Myisam_storage_engine=1-dwith_innobase_storage_engine=1-dwith_memory_storage_engine=1-dwith_readline=1-dmysql_ Unix_addr=/var/lib/mysql/mysql.sock-dmysql_tcp_port=3306-dwith_partition_storage_engine=1-dextra_charsets=all- Ddefault_charset=utf8-ddefault_collation=utf8_general_ci #配置
[[Email protected]]# make #编译
[[Email protected]]# make install #安装
6. Licensing MySQL installation directory permissions
#对mysql安装目录进行授权操作
[Email protected] ~]chmod-r Mysql.mysql/application/mysql
7. Initializing MySQL Database
[[Email protected]~]cd/application/mysql/scripts/
[Email protected]~]./mysql_install_db--user=mysql--basedir=/application/mysql--datadir=/application/mysql/data
8. Configure MySQL Startup service
[[Email protected]~]cd/application/mysql/support-files/
[Email protected]]# CP Mysql.server/etc/rc.d/init.d/mysql
[Email protected]]#/bin/cp my-default.cnf/etc/my.cnf
[Email protected]~]chkconfig--add MySQL
[[Email Protected]~]chkconfig MySQL on
9. Start the MySQL database
[[Email Protected]~]/etc/init.d/mysql start
[[Email protected]~]lsof-i:3306
10. Modify the character set to prevent garbled characters
#添加如下配置内容, the service-side character set needs to be consistent with the client
[[Email protected]~]vim/etc/my.cnf
[Mysqld]
Character-set-server=utf8
[Client]
Default-character-set=utf8
[MySQL]
Default-character-set=utf8
[[Email Protected]~]/etc/init.d/mysql restart
11. Add the MySQL bin to the environment variable
#加入如下配置代码 can also be added to the Global environment variable
[Email protected]~]# CD ~
[Email protected]~]vim. bash_profile
[Email protected]~]# cat. Bash_profile
#.bash_profile
#Get the aliases and functions
If[-F ~/.BASHRC]; Then
. ~/.bashrc
Fi
#User specific environment and startup programs
Path= $PATH: $HOME/bin
Path=/application/mysql/bin: $PATH
Exportpath
[Email protected]~]. . bash_profile
12. Set MySQL database password and remote access permissions
#mysql数据库初次安装完毕后, no password is required to log on by default
[[Email protected]~]# mysql–uroot
Mysql>setpassword for ' root ' @ ' localhost ' = PASSWORD (' 123456 '); #设置登录密码
Mysql>flush privileges;
Queryok, 0 rows Affected (0.00 sec)
[Email protected]~]# mysql–uroot #验证
ERROR1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)
[[Email protected]~]# mysql-uroot-p
Enterpassword:
This article is from the "Proud & Wind" blog, so be sure to keep this source http://6197435.blog.51cto.com/6187435/1866867
Linux under CMake Way compile and install MySQL database