程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> MYSQL數據庫 >> MySQL綜合教程 >> VMware10.0.4下 CentOS 6.5 cmake安裝 MySQL 5.5.32,centoscmake

VMware10.0.4下 CentOS 6.5 cmake安裝 MySQL 5.5.32,centoscmake

編輯:MySQL綜合教程

VMware10.0.4下 CentOS 6.5 cmake安裝 MySQL 5.5.32,centoscmake


一、准備工作

1.1、創建 zhuzz/tools目錄

[root@localhost ~]# mkdir -p /home/zhuzz/tools
[root@localhost ~]# cd /home/zhuzz/tools

 

1.2、將cmake-2.8.8.tar.gz|mysql-5.5.32.tar 上傳至 zhuzz/tools目錄

[root@localhost tools]# rz -y

 

1.3、解壓cmake安裝包
[root@localhost tools]# tar xf cmake-2.8.8.tar.gz
  1.4、安裝cmake安裝包
[root@localhost tools]# cd cmake-2.8.8
[root@localhost cmake-2.8.8]# ./configure
##### 報錯 #####
---------------------------------------------
CMake 2.8.8, Copyright 2000-2011 Kitware, Inc.
---------------------------------------------
Error when bootstrapping CMake:
Cannot find appropriate C compiler on this system.
Please specify one using environment variable CC.
See cmake_bootstrap.log for compilers attempted.
 
---------------------------------------------
Log of errors: /home/zhuzz/tools/cmake-2.8.8/Bootstrap.cmk/cmake_bootstrap.log
---------------------------------------------
##### 解決方法 下載安裝gcc-c++ #####
[root@localhost cmake-2.8.8]# yum install gcc-c++

 

[root@localhost cmake-2.8.8]# gmake 
[root@localhost cmake-2.8.8]# gmake install

 

1.5、安裝依賴包 ncurses-devel
[root@localhost cmake-2.8.8]# yum install ncurses-devel -y
    二、安裝 2.1、創建用戶和組
[root@localhost cmake-2.8.8]# groupadd mysql
[root@localhost cmake-2.8.8]# useradd mysql -s /sbin/nologin -M -g mysql

 

2.2、解壓 mysql-5.5.32.tar.gz 並 進入此目錄
[root@localhost cmake-2.8.8]# cd ..
[root@localhost tools]# tar xf mysql-5.5.32.tar.gz
[root@localhost tools]# cd mysql-5.5.32

 

2.3、解壓編譯MySQL安裝包
[root@localhost tools]# cmake . -DCMAKE_INSTALL_PREFIX=/usr/local/mysql-5.5.32 \
-DMYSQL_DATADIR=/usr/local/mysql-5.5.32/data \
-DMYSQL_UNIX_ADDR=/usr/local/mysql-5.5.32/tmp/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DEXTRA_CHARSETS=gbk,gb2312,utf8,ascii \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_FEDERATED_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_DEBUG=0 \

 

[root@localhost mysql-5.5.32]# make && make install

 

2.4、創建軟鏈接
[root@localhost mysql-5.5.32]# ln -s /usr/local/mysql-5.5.32/  /usr/local/mysql

 

2.5、配置文件
[root@localhost mysql-5.5.32]# cp support-files/my-small.cnf /etc/my.cnf 

 

  2.6、配置環境變量
[root@localhost mysql-5.5.32]# echo 'export PATH=/usr/local/mysql/bin:$PATH' >> /etc/profile
[root@localhost mysql-5.5.32]# tail -l /etc/profile
[root@localhost mysql-5.5.32]# source /etc/profile
[root@localhost mysql-5.5.32]# echo $PATH
/usr/local/mysql/bin:/usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin

 

2.7、授權
[root@localhost mysql-5.5.32]# cd /usr/local/mysql
[root@localhost mysql]# chown -R mysql.mysql ./
[root@localhost mysql]# chmod -R 1777 /tmp/

 

三、初始化、啟動
3.1、進入安裝目錄的mysql/scripts目錄並初始化
[root@localhost mysql]# cd /usr/local/mysql/scripts/

[root@localhost scripts]# ./mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data/ --user=mysql

 

##### 看見一下則初始化OK #####
Installing MySQL system tables...
OK
Filling help tables...
OK

 

3.2配置文件
[root@localhost scripts]# cd /home/zhuzz/tools/mysql-5.5.32
[root@localhost mysql-5.5.32]# cp support-files/mysql.server /etc/init.d/mysqld

 

3.3、給mysql啟動目錄授權

[root@localhost mysql-5.5.32]# chmod +x /etc/init.d/mysqld

 

3.4、啟動MySQL

[root@localhost mysql-5.5.32]# /etc/init.d/mysqld start
[root@localhost mysql-5.5.32]# mysql
mysql> quit

 

3.5、修改密碼bin驗證是否安裝成功

[root@localhost mysql-5.5.32]# /usr/local/mysql//bin/mysqladmin -u root password 'root'
[root@localhost mysql-5.5.32]# chkconfig mysqld on
[root@localhost mysql-5.5.32]# chkconfig --list mysqld
 mysqld          0:關閉  1:關閉  2:啟用  3:啟用  4:啟用  5:啟用  6:關閉

 

四、備注:

4.1、添加額外的管理員
mysql>delete from mysql.user;

mysql>grant all privileges on *.* to system@'localhost' identified by 'system' with grant option;

 

4.2、初始化成功顯示如下

Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/usr/local/mysql//bin/mysqladmin -u root password 'new-password'
/usr/local/mysql//bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

Alternatively you can run:
/usr/local/mysql//bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr/local/mysql/ ; /usr/local/mysql//bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql//mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/mysql//scripts/mysqlbug script!

 

 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved