解決centos6.5編譯MySQL報錯exec: g++: not found

來源:互聯網
上載者:User

解決centos6.5編譯MySQL報錯exec: g++: not found

./configure --prefix=/usr/local/mysql --with-extra-charsets=all --with-innodb --with-plugins=partition

然後進行make

報如下錯誤

../depcomp: line 571: exec: g++: not found

make[1]: *** [my_new.o] Error 127

make[1]: Leaving directory `/usr/local/src/mysql-5.1.34/mysys'

make: *** [all-recursive] Error 1

網上回答是

yum install -y gcc-c++

好吧,安裝了這個,這個錯是沒有報,再執行make

./include/my_global.h:1110: error: redeclaration of C++ built-in type ‘bool’

查詢了一下,網友說是沒有安裝c++,但是我查詢了一下,有啊

[root@localhost Packages]# rpm -qa | grep gcc-c++

gcc-c++-4.4.7-11.el6.i686

再看看別的文章,說可以重新./configure試試,好吧,重來吧

[root@localhost Packages]# !145 斷行符號走你

我是虛擬機器安裝的centos,分配了730M記憶體,make一下怎麼這麼久啊,艸留都逛了一圈了,還沒完事……

make竟然沒有報錯,趕緊make install

竟然沒有再報錯

下一步我們就來進行初始化一下

[root@localhost bin]# ./mysql_install_db

看看/usr/local/mysql產生var這個檔案夾,如果有,則說明產生成功

[root@localhost var]# ls

localhost.localdomain.err mysql test

[root@localhost var]# pwd

/usr/local/mysql/var

然後再把這個MySQL服務起來一下

我竟然執行了servie mysqld restart ,結果可想而知……

[root@localhost bin]# ./mysqld_safe --user=mysql &

然後可以驗證下有沒有跑起來

[root@localhost Packages]# ps -aux | grep 'mysql'

Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.8/FAQ

root 31177 0.0 0.1 4356 744 pts/1 S+ 00:42 0:00 grep mysql

好,起來了,人品不錯嘛,該設定一個密碼了

[root@localhost bin]# /usr/local/mysql/bin/mysqladmin password 123456

/usr/local/mysql/bin/mysqladmin: connect to server at 'localhost' failed

error: 'Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)'

Check that mysqld is running and that the socket: '/tmp/mysql.sock' exists!

服務這一塊咱是起來了,那麼去tmp瞅瞅吧,進去一看,還真是沒有

看看日誌吧,log裡面MySQL開頭的只有這一個,應該就是這個吧,開啟瞅瞅

less /var/log/mysqld.log.rpmsave

150429 09:56:41 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

進去/var/run,再按table怎麼也不出來mysqld……,竟然沒有這個檔案夾?

那我就建立一個試試

[root@localhost tmp]# mkdir /var/run/mysqld&&touch mysqld.pid&&vim mysqld.pid

我們先把服務加進來

cd /usr/local/mysql/share/mysql

[root@localhost mysql]# cp mysql.server /etc/init.d/mysqld

chkconfig --add mysqld

chkconfig --list mysqld

chkconfig --lerels 35 mysqld on

service mysqld restart

我靠,有報錯

[root@localhost mysql]# service mysqld restart

ERROR! MySQL manager or server PID file could not be found!

Starting MySQL. ERROR! Manager of pid-file quit without updating file.


在想起寫這個記錄前面還遇到兩個問題,當時忘了記錄……

好像有個什麼redeclaration of C++ built-in type ‘bool’

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.