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

mysql 5.6.24安裝實例,mysql5.6.24實例

編輯:MySQL綜合教程

mysql 5.6.24安裝實例,mysql5.6.24實例


安裝前准備工作:


1)編輯PATH路徑

vim /etc/profile

PATH=/home/mysql/bin:/home/mysql/lib:$PATH

export PATH

2)生效PATH

source /etc/profile

3)編輯hosts

vim /etc/hosts

192.168.117.130  cc-test


安裝

1.環境配置

yum install - y gcc gcc-c++ make cmake

2.准備好安裝包mysql-5.6.24.tar.gz,並將它拷貝到/home目錄下

rz

3.解壓安裝包並更名


tar -zxvf mysql-5.6.2.tar.gz

mv mysql-5.6.2.tar.gz  mysql

4.新增用戶組 及用戶

groupadd mysql

useradd mysql -g mysql

5.創建data

mkdir /home/mysql/data

6.編譯mysql

cmake \
-DCMAKE_INSTALL_PREFIX=/home/mysql \
-DMYSQL_UNIX_ADDR=/home/mysql/mysql.sock \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_ARCHIVE_STORAGE_ENGINE=1 \
-DWITH_BLACKHOLE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DENABLED_LOCAL_INFILE=1 \
-DMYSQL_DATADIR=/home/mysql/data \
-DMYSQL_USER=mysql \
-DMYSQL_TCP_PORT=3306

7.安裝

make install

make clean

8.修改目錄擁有者

chown -R mysql:mysql /home/mysql

chown -R mysql:mysql /home/mysql/data

9.初始化配置腳本

scripts /mysql-install-db --user=nysql --datadir=/home/mysql/data

10.重新更改權限

chown -R mysql:mysql /home/mysql

11.復制服務器啟動腳本

cp /home/mysql/support-files/mysql.server  /etc/init.d/mysql

chmod 755 /etc/init.d/mysql

cp /home/mysql/support-files/my-default.cnf  /etc/my.cnf

12.啟動

service mysqld start

13.netstat -anp 查看端口是否監聽上

14.進入mysql

cd /mysql/bin

./mysql -u root -p


 

問題1:

[root@cc-test mysql]# cmake .

出現以下錯誤提示:

-- Could NOT find Curses (missing: CURSES_LIBRARY CURSES_INCLUDE_PATH)
CMake Error at cmake/readline.cmake:82 (MESSAGE):
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.
Call Stack (most recent call first):
cmake/readline.cmake:126 (FIND_CURSES)
cmake/readline.cmake:216 (MYSQL_USE_BUNDLED_LIBEDIT)
CMakeLists.txt:250 (MYSQL_CHECK_READLINE)


-- Configuring incomplete, errors occurred!

解決方法:

[root@cc-test mysql]# rm CMakeCache.txt
[root@cc-test mysql]# yum install ncurses-devel
Warning: Bison executable not found in PATH
-- Configuring done
-- Generating done
-- Build files have been written to: /software/mysql-5.5.11
[root@cc-test mysql]# yum install bison
[root@cc-test mysql]# cmake ……
[root@cc-test mysql]# make install

 

問題2:

[root@cc-test mysql]# scripts/mysql_install_db --user=mysql --datadir=/home/mysql/data
-bash: scripts/mysql_install_db: Permission denied

解決方法:

[root@cc-test mysql]# chmod 755 scripts/mysql_install_db

問題3:

service mysqld start 啟動時發生 PID錯誤

解決方法:

chown -R mysql.mysql

su - mysql

-bash-4.1$    (ctrl+d)

scripts /mysql.install_db/home/mysql/bin/mysql_safe --user=mysql&/etc/rc.d/init.d/mysqld  status

/etc/rc.d/init.d/mysqld start

 

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