?id=65598
第一種安裝方式:
安裝MySQL后,需要初始化 授權表、啟動(dòng)服務(wù)器,并確保服務(wù)器工作正常。你還要讓服務(wù)器隨系統的啟動(dòng)和停止自動(dòng)啟動(dòng)和停止。應當為授權表中的賬戶(hù)指定密碼。在某些安裝中,該程序自動(dòng)運行。
1、添加mysql用戶(hù)組以及用戶(hù)
groupadd mysql
useradd -g mysql mysql
2、解壓mysql 并制定安裝目錄
cd /root/software/
tar xvzf mysql-5.1.68.tar.gz
cd mysql-5.1.68
3、configure
第一次配置 configure
./configure --prefix=/usr/local/mysql/ --with-server-suffix=-unionread-edition --enable-assembler --enable-local-infile --enable-thread-safe-client --with-charset=utf8 --with-extra-charsets=gbk,gb2312,utf8,ascii --with-readline --with-ssl --with-embedded-server --with-pthread --with-mysqld-user=mysql --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-plugins=partition,innobase,innodb_plugin
報錯:
checking for tgetent in -lncursesw... no
checking for tgetent in -lncurses... no
checking for tgetent in -lcurses... no
checking for tgetent in -ltermcap... no
checking for tgetent in -ltinfo... no
checking for termcap functions library... configure: error: No curses/termcap library found
問(wèn)題:configure時(shí)遇到缺少ncurses依賴(lài)包
解決:
查看nucrses并安裝ncurses依賴(lài)包
yum list|grep ncurses
yum -y install ncurses-devel
安裝完成以后重新配置 configure
./configure --prefix=/usr/local/mysql/ --with-server-suffix=-unionread-edition --enable-assembler --enable-local-infile --enable-thread-safe-client --with-charset=utf8 --with-extra-charsets=gbk,gb2312,utf8,ascii --with-readline --with-ssl --with-embedded-server --with-pthread --with-mysqld-user=mysql --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-plugins=partition,innobase,innodb_plugin
Thank you for choosing MySQL! mysql安裝的第一步成功
4、make && make install
報錯:
make[1]: Entering directory `/root/software/mysql-5.1.68/mysys'
source='my_new.cc' object='my_new.o' libtool=no \
DEPDIR=.deps depmode=none /bin/sh ../depcomp \
g++ -DDEFAULT_BASEDIR=http://blog.51cto.com/sangebujiangjiu/1868034/\"/home/mysql\" -DMYSQL_DATADIR="http://blog.51cto.com/sangebujiangjiu/1868034/\"/home/mysql/var\"" -DDEFAULT_CHARSET_HOME="http://blog.51cto.com/sangebujiangjiu/1868034/\"/home/mysql\"" -DSHAREDIR="http://blog.51cto.com/sangebujiangjiu/1868034/\"/home/mysql/share/mysql\"" -DDEFAULT_HOME_ENV=MYSQL_HOME -DDEFAULT_GROUP_SUFFIX_ENV=MYSQL_GROUP_SUFFIX -DDEFAULT_SYSCONFDIR="http://blog.51cto.com/sangebujiangjiu/1868034/\"/home/mysql/etc\"" -DHAVE_CONFIG_H -I. -I../include -I../include -I../include -I. -O -fno-implicit-templates -fno-exceptions -fno-rtti -c -o my_new.o my_new.cc
../depcomp: line 571: exec: g++: not found
make[1]: *** [my_new.o] Error 127
make[1]: Leaving directory `/root/software/mysql-5.1.68/mysys'
make: *** [all-recursive] Error 1
問(wèn)題:g++ not found 。
對比查看發(fā)現GCC已經(jīng)安裝但缺少g++,所以make時(shí)報錯。
安裝gcc-c++
[root@open2 ~/software]# yum -y install gcc-c++
第三次 ./configure
./configure --prefix=/usr/local/mysql/ --with-server-suffix=-unionread-edition --enable-assembler --enable-local-infile --enable-thread-safe-client --with-charset=utf8 --with-extra-charsets=gbk,gb2312,utf8,ascii --with-readline --with-ssl --with-embedded-server --with-pthread --with-mysqld-user=mysql --with-mysqld-ldflags=-all-static --with-client-ldflags=-all-static --with-plugins=partition,innobase,innodb_plugin
make && make install
漫長(cháng)的等待。
5、初始化授權表:
/usr/local/mysql/bin/mysql_install_db --user=mysql --datadir=/var/lib/mysql/
copy配置文件:
cp /usr/local/mysql/share/my-medium.cnf /etc/my.cnf
6、啟動(dòng)mysql服務(wù)
/usr/local/mysql/bin/mysqld_safe &
設置啟動(dòng)服務(wù)
cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/mysqld
chkconfig --add mysqld
chkconfig --level 345 mysqld on
#復制mysql啟動(dòng)到用戶(hù)path下
cp /usr/local/mysql/bin/mysql /usr/bin/mysql
#啟動(dòng)mysql
service mysqld start
鍵入mysql 或者 全路徑 /usr/local/mysql/bin/mysql
可以登陸了。
免責聲明:本站發(fā)布的內容(圖片、視頻和文字)以原創(chuàng )、來(lái)自本網(wǎng)站內容采集于網(wǎng)絡(luò )互聯(lián)網(wǎng)轉載等其它媒體和分享為主,內容觀(guān)點(diǎn)不代表本網(wǎng)站立場(chǎng),如侵犯了原作者的版權,請告知一經(jīng)查實(shí),將立刻刪除涉嫌侵權內容,聯(lián)系我們QQ:712375056,同時(shí)歡迎投稿傳遞力量。
Copyright ? 2009-2022 56dr.com. All Rights Reserved. 特網(wǎng)科技 特網(wǎng)云 版權所有 特網(wǎng)科技 粵ICP備16109289號
域名注冊服務(wù)機構:阿里云計算有限公司(萬(wàn)網(wǎng)) 域名服務(wù)機構:煙臺帝思普網(wǎng)絡(luò )科技有限公司(DNSPod) CDN服務(wù):阿里云計算有限公司 百度云 中國互聯(lián)網(wǎng)舉報中心 增值電信業(yè)務(wù)經(jīng)營(yíng)許可證B2
建議您使用Chrome、Firefox、Edge、IE10及以上版本和360等主流瀏覽器瀏覽本網(wǎng)站