cmake安裝MySQL

來源:互聯網
上載者:User

標籤:

1、編輯指令碼cmake_mysql_install.sh,輸入以下內容:

#!/bin/bash#下載並安裝makeyum -y install gcc   #排除錯誤:configure: error: in `/usr/local/src/make-4.1‘:   configure: error: no acceptable C compiler found in $PATHcd /usr/local/src/wget http://ftp.gnu.org/gnu/make/make-4.1.tar.gztar zxvf make-4.1.tar.gzcd make-4.1./configuremake && make install#下載並安裝bisoncd /usr/local/src/          wget http://alpha.gnu.org/gnu/bison/bison-2.7.91.tar.gz tar zxvf bison-2.7.91.tar.gzcd bison-2.7.91./configuremake && make install#安裝gcc-c++yum -y install gcc-c++#下載並解壓camkecd /usr/local/src/wget http://www.cmake.org/files/v3.2/cmake-3.2.2.tar.gz
tar zxvf cmake-3.2.2.tar.gz
cd cmake-3.2.2
./bootstrap
gmake && gmake install
#下載安裝ncursescd /usr/local/src/wget http://ftp.gnu.org/pub/gnu/ncurses/ncurses-5.9.tar.gztar -zxvf ncurses-5.9.tar.gzcd ncurses-5.9./configuremake && make install#安裝mysql
#首先,建立mysql使用者、組
groupadd mysql
useradd -g mysql mysql -s /usr/sbin/nologin
mkdir /usr/local/mysql # 建立目錄
mkdir /usr/local/mysql/data # 資料倉儲目錄
cd /usr/local/src/ wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.24.tar.gz
#解壓安裝tar zxvf mysql-5.6.24.tar.gzcd mysql-5.6.24cmake -DCMAKE_INSTALL_PREFIX=/usr/local/mysql              #安裝路徑make && make install cd /usr/local/mysqlscripts/mysql_install_db --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --user=mysql   #初始化mysql資料庫 cp support-files/my-medium.cnf /usr/local/mysql/my.cnf                                             #copy設定檔chown -R mysql:mysql /usr/local/mysql                                                              #更改許可權

 2、# nano /usr/local/mysql/my.cnf ,添加以下內容:

[mysqld]
basedir = /usr/local/mysqldatadir = /usr/local/mysql/datalog-error = /usr/local/mysql/mysql_error.logpid-file = /usr/local/mysql/mysql.piduser = mysqltmpdir = /tmp

注意:對於nano,要儲存所做的修改,按下Ctrl+O;退出,按下Ctrl+X。若退出前沒有儲存所做的修改,它會提示你是否要儲存。如果不要,請按N,反之,則按Y。然後它會讓你確認要儲存的檔案名稱,確認或修改後按Enter即可。

如果你沒有修改好而不小心按了儲存鍵,您可以在請求確認檔案名稱時按Ctrl+C來取消。

3、啟動MySQL:

# cd /usr/local/mysql/support-files/# cp ./mysql.server /etc/init.d/mysqld# /etc/init.d/mysqld start

 4、進入MySQL命令列;

$ mysqlbash: mysql: command not found
$ which mysql/usr/bin/which: no mysql in (/usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/lot/bin:/usr/local/python27/bin:/home/lot/bin)[[email protected] ~]$ whereis mysqlmysql: /usr/lib64/mysql /usr/local/mysql /usr/share/mysql# ln -s /usr/local/mysql/bin/mysql /usr/bin

  # mysql
  ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘ (2)

# ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
# service mysqld restart

5、好了,

[[email protected] bin]# service mysqld restart ERROR! MySQL server PID file could not be found!Starting MySQL... SUCCESS! [[email protected] bin]# mysqlWelcome to the MySQL monitor.  Commands end with ; or \g.Your MySQL connection id is 1Server version: 5.6.24 Source distributionCopyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.mysql> show databases;+--------------------+| Database           |+--------------------+| information_schema || mysql              || performance_schema || test               |+--------------------+4 rows in set (0.04 sec)
View Code

安裝參考網址:

使用cmake安裝mysql5.5.13:http://blog.chinaunix.net/uid-10435474-id-2957157.html

linux cmake 安裝mysql5.5.11,以及更高版本:http://www.360doc.com/content/12/0304/19/2054285_191664568.shtml

Linux下的Nano命令:http://www.cnblogs.com/haichuan3000/articles/2125943.html

CMAKE安裝MYSQL 5.6.10:http://www.2cto.com/database/201305/208302.html

LINUX下使用CMAKE安裝MYSQL(源碼編譯):http://www.cnblogs.com/AloneSword/archive/2013/03/18/2966750.html

問題處理參考網址:

解決bash: mysql: command not found 的方法:http://www.jb51.net/article/34622.htm

ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘:http://blog.csdn.net/wyzxg/article/details/4720041

ERROR 2002 (HY000): Can‘t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock‘ (2):http://www.cnblogs.com/chinas/p/4504533.html

cmake安裝MySQL

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.