欧美一级特黄大片做受成人-亚洲成人一区二区电影-激情熟女一区二区三区-日韩专区欧美专区国产专区

怎么用源碼安裝MYSQL-創(chuàng)新互聯(lián)

這篇文章主要介紹“怎么用源碼安裝MYSQL”,在日常操作中,相信很多人在怎么用源碼安裝MYSQL問(wèn)題上存在疑惑,小編查閱了各式資料,整理出簡(jiǎn)單好用的操作方法,希望對(duì)大家解答”怎么用源碼安裝MYSQL”的疑惑有所幫助!接下來(lái),請(qǐng)跟著小編一起來(lái)學(xué)習(xí)吧!

尋甸ssl適用于網(wǎng)站、小程序/APP、API接口等需要進(jìn)行數(shù)據(jù)傳輸應(yīng)用場(chǎng)景,ssl證書未來(lái)市場(chǎng)廣闊!成為創(chuàng)新互聯(lián)的ssl證書銷售渠道,可以享受市場(chǎng)價(jià)格4-6折優(yōu)惠!如果有意向歡迎電話聯(lián)系或者加微信:028-86922220(備注:SSL證書合作)期待與您的合作!

一、文章說(shuō)明

  最近接觸到mysql數(shù)據(jù)庫(kù),因此閑來(lái)研究一下,今天演示一下用源碼安裝mysql,如果使用rpm包安裝的話個(gè)人感覺(jué)挺簡(jiǎn)單的。

  環(huán)境說(shuō)明:

    操作系統(tǒng):rhel 5.4 x86

    Mysql版本:mysql-5.5.22

二、安裝cmake(mysql5.5以后是通過(guò)cmake來(lái)編譯的)

  在mysql5.5之前的話直接編輯就可以,而在5.5以后需要通過(guò)cmake來(lái)編譯,在附錄中介紹一下直接編譯。

  下載cmake-2.8.4.tar.gz,本人是在度娘搜的。

[root@node4 ~]# tar -zxvf cmake-2.8.4.tar.gz [root@node4 ~]# cd cmake-2.8.4 [root@node4 cmake-2.8.4]# ./configure --prefix=/usr/local/cmake ----在這里可以使用# gmake && make install [root@node4 cmake-2.8.4]# make [root@node4 cmake-2.8.4]# make install

  備注:configure需要執(zhí)行編譯到目錄。
三、創(chuàng)建mysql的安裝目錄及數(shù)據(jù)庫(kù)存放目錄

[root@node4 ~]# mkdir -p /opt/mysql5.5 [root@node4 ~]# mkdir -p /opt/mysql5.5/data

四、創(chuàng)建mysql用戶及用戶組

[root@node4 ~]# groupadd mysql [root@node4 ~]# useradd -r -g mysql mysql

五、安裝mysql

[root@node4 ~]# tar -zxvf mysql-5.5.22.tar.gz [root@node4 ~]# cd mysql-5.5.22 ----編譯出現(xiàn)以下錯(cuò)誤,需要ncurses-devel [root@node4 mysql-5.5.22]#/usr/local/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql5.5 -DMYSQL_DATADIR=/opt/mysql5.5/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 -- MySQL 5.5.22 -- Could NOT find Curses (missing:  CURSES_LIBRARY CURSES_INCLUDE_PATH)  CMake Error at cmake/readline.cmake:83 (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:127 (FIND_CURSES)
  cmake/readline.cmake:217 (MYSQL_USE_BUNDLED_LIBEDIT)
  CMakeLists.txt:268 (MYSQL_CHECK_READLINE) -- Configuring incomplete, errors occurred! ----查看ncurses是否安裝: [root@node4 mysql-5.5.22]# rpm -qa|grep necurses
ncurses-5.5-24.20060715 ----安裝ncurses-devel [root@node4]# rpm -ivh ncurses-devel-5.5-24.20060715.i386.rpm 
warning: ncurses-devel-5.5-24.20060715.i386.rpm: Header V3 DSA signature: NOKEY, key ID 37017186 Preparing...                ########################################### [100%] 1:ncurses-devel          ########################################### [100%] ----刪除CMakeCache.txt [root@node4 mysql-5.5.22]# find / -name CMakeCache.txt /root/mysql-5.5.22/CMakeCache.txt /root/cmake-2.8.4/CMakeCache.txt /root/cmake-2.8.4/Tests/ComplexOneConfig/Cache/CMakeCache.txt /root/cmake-2.8.4/Tests/Complex/Cache/CMakeCache.txt /root/cmake-2.8.4/Tests/CMakeFiles/CheckFortran/CMakeCache.txt /root/cmake-2.8.4/Tests/ComplexRelativePaths/Cache/CMakeCache.txt [root@node4 mysql-5.5.22]# rm /root/mysql-5.5.22/CMakeCache.txt
rm: remove regular file `/root/mysql-5.5.22/CMakeCache.txt'? yes
[root@node4 mysql-5.5.22]# rm /root/cmake-2.8.4/CMakeCache.txt
rm: remove regular file `/root/cmake-2.8.4/CMakeCache.txt'? yes [root@node4 mysql-5.5.22]# rm /root/cmake-2.8.4/Tests/ComplexOneConfig/Cache/CMakeCache.txt
rm: remove regular file `/root/cmake-2.8.4/Tests/ComplexOneConfig/Cache/CMakeCache.txt'? yes
[root@node4 mysql-5.5.22]# rm /root/cmake-2.8.4/Tests/Complex/Cache/CMakeCache.txt
rm: remove regular file `/root/cmake-2.8.4/Tests/Complex/Cache/CMakeCache.txt'? yes [root@node4 mysql-5.5.22]# rm /root/cmake-2.8.4/Tests/CMakeFiles/CheckFortran/CMakeCache.txt
rm: remove regular file `/root/cmake-2.8.4/Tests/CMakeFiles/CheckFortran/CMakeCache.txt'? yes
[root@node4 mysql-5.5.22]# rm /root/cmake-2.8.4/Tests/ComplexRelativePaths/Cache/CMakeCache.txt
rm: remove regular file `/root/cmake-2.8.4/Tests/ComplexRelativePaths/Cache/CMakeCache.txt'? yes ----再次進(jìn)行編譯: [root@node4 mysql-5.5.22]#/usr/local/cmake/bin/cmake -DCMAKE_INSTALL_PREFIX=/opt/mysql5.5 -DMYSQL_DATADIR=/opt/mysql5.5/data -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DEXTRA_CHARSETS=all -DENABLED_LOCAL_INFILE=1 [root@node4 mysql-5.5.22]#make && make install

  備注:

-DCMAKE_INSTALL_PREFIX=/usr/local/mysql        //安裝目錄

-DINSTALL_DATADIR=/usr/local/mysql/data         //數(shù)據(jù)庫(kù)存放目錄

-DDEFAULT_CHARSET=utf8                        //使用utf8字符

-DDEFAULT_COLLATION=utf8_general_ci            //校驗(yàn)字符

-DEXTRA_CHARSETS=all                            //安裝所有擴(kuò)展字符集

-DENABLED_LOCAL_INFILE=1                        //允許從本地導(dǎo)入數(shù)據(jù)

  注意事項(xiàng):

  重新編譯時(shí),需要清除舊的對(duì)象文件和緩存信息。

  #make clean

  #rm -f CMakeCache.txt

  #rm -rf /etc/my.cnf

六、設(shè)置目錄權(quán)限

[root@node4 ~]# cd /opt/mysql5.5/ [root@node4 mysql5.5]# chown -R root:mysql .     //把當(dāng)前目錄中所有文件的所有者設(shè)為root,所屬組為mysql [root@node4 mysql5.5]# chown -R mysql:mysql data/

七、設(shè)置mysql配置文件

[root@node4 mysql5.5]# cp support-files/my-medium.cnf /etc/my.cnf    //將mysql的啟動(dòng)服務(wù)添加到系統(tǒng)服務(wù)中 [root@node4 mysql5.5]# cp support-files/my-medium.cnf my.cnf [root@node4 mysql5.5]# more my.cnf 
----在mysqld下面添加basedir = /opt/mysql5.5 datadir = /opt/mysql5.5/data [mysqld] port = 3306 socket = /tmp/mysql.sock
skip-external-locking
key_buffer_size = 16M
max_allowed_packet = 1M
table_open_cache = 64 sort_buffer_size = 512K
net_buffer_length = 8K
read_buffer_size = 256K
read_rnd_buffer_size = 512K
myisam_sort_buffer_size = 8M
basedir = /opt/mysql5.5 datadir = /opt/mysql5.5/data

八、創(chuàng)建系統(tǒng)數(shù)據(jù)庫(kù)的表

----在這里指定了配置文件和用戶 [root@node4 mysql5.5]# scripts/mysql_install_db --defaults-file=./my.cnf --user=mysql  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: /opt/mysql5.5/bin/mysqladmin -u root password 'new-password' /opt/mysql5.5/bin/mysqladmin -u root -h node4 password 'new-password' Alternatively you can run: /opt/mysql5.5/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 /opt/mysql5.5 ; /opt/mysql5.5/bin/mysqld_safe & You can test the MySQL daemon with mysql-test-run.pl
cd /opt/mysql5.5/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /opt/mysql5.5/scripts/mysqlbug script!

九、設(shè)置環(huán)境變量

[root@node4 ~]# vi /root/.bash_profile ----在PATH=$PATH:$HOME/bin添加參數(shù)為:  PATH=$PATH:$HOME/bin:/opt/mysql5.5/bin:/opt/mysql5.5/lib [root@node4 ~]# source /root/.bash_profile

十、手動(dòng)啟動(dòng)mysql

[root@node4 mysql5.5]# ./bin/mysqld_safe --user=mysql &   //啟動(dòng)MySql但不能停止 [1] 27412 [root@node4 mysql5.5]# 130728 08:34:38 mysqld_safe Logging to '/opt/mysql5.5/data/node4.err'. 130728 08:34:38 mysqld_safe Starting mysqld daemon with databases from /opt/mysql5.5/data

----這里MYSQL的root用戶還沒(méi)有配置密碼,所以空值。需要輸入密碼時(shí),直接點(diǎn)回車鍵即可。 [root@node4 mysql5.5]# ./bin/mysqladmin -u root -p shutdown Enter password: 130728 08:34:46 mysqld_safe mysqld from pid file /opt/mysql5.5/data/node4.pid ended [1]+ Done                    ./bin/mysqld_safe --user=mysql

十一、另一個(gè)簡(jiǎn)單的啟動(dòng)mysql的方法(mysql已經(jīng)被添加到系統(tǒng)服務(wù)中)

[root@node4 mysql5.5]# service mysql start [root@node4 mysql5.5]# service mysql stop [root@node4 mysql5.5]# service mysql restart

  如果上述命令出現(xiàn):mysql未識(shí)別的服務(wù)

[root@node4 mysql5.5]# service mysql start
mysql.server: unrecognized service

  則可能mysql還沒(méi)添加到系統(tǒng)服務(wù)中,下面用另一個(gè)方法添加:

[root@node4 mysql5.5]# cp support-files/mysql.server /etc/init.d/mysql [root@node4 mysql5.5]# service mysql start
Starting MySQL... [ OK ] [root@node4 mysql5.5]# service mysql stop
Shutting down MySQL. [ OK ]

  注意:主要是將mysql.server拷貝到/etc/init.d中,命名為mysql。然后再用#service mysql start 來(lái)啟動(dòng)mysql即可。

十二、修改Mysql的root用戶密碼以及打開(kāi)遠(yuǎn)程連接

[root@node4 ~]# /opt/mysql5.5/bin/mysql -u root mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 Server version: 5.5.22-log Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql; Database changed
mysql> desc user;
----為root添加遠(yuǎn)程連接的能力。
mysql> grant all privileges on *.* to root@"%" identified by "root";
Query OK, 0 rows affected (0.03 sec)

mysql> update user set Password = password('123456') where User='root';
Query OK, 5 rows affected (0.02 sec)
Rows matched: 5 Changed: 5 Warnings: 0 mysql> select Host,User,Password from user where User='root'; +-----------+------+-------------------------------------------+ | Host | User | Password | +-----------+------+-------------------------------------------+ | localhost | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | node4 | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | 127.0.0.1 | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | ::1 | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | | % | root | *6BB4837EB74329105EE4568DDA7DC67ED2CA2AD9 | +-----------+------+-------------------------------------------+ 5 rows in set (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.01 sec)

mysql> exit;
Bye [root@node4 ~]# /opt/mysql5.5/bin/mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3 Server version: 5.5.22-log Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

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.10 sec)
mysql> select version(); +------------+ | version() | +------------+ | 5.5.22-log | +------------+ 1 row in set (0.02 sec)

附錄:
  1. groupadd mysql
  2. useradd -g mysql mysql
  3. tar zxvf mysql-VERSION.tar.gz
  4. cd mysql-VERSION
  5. ./configure --prefix=/usr/local/mysql   
  --without-debug   
  --enable-thread-safe-client  
  --enable-assembler   
  --enable-profiling   
  --with-mysqld-ldflags=-all-static  
  --with-client-ldflags=-all-static   
  --with-charset=latin1   
  --with-extra-charsets=utf8,gbk  
  --with-mysqld-user=mysql   
  --without-embedded-server  
  --with-server-suffix=bbk   
  --with-plugins=innobase,partition
  6. make
  7. make install
  8.mkdir data
  9.chown mysql:mysql ./data/ -R
  10. cp support-files/my-medium.cnf /etc/my.cnf
  11.在my.cnf mysqld標(biāo)簽下中添加:
     basedir=/opt/mysql5
     datadir=/opt/mysql5/data
  12. ./bin/mysql_install_db --default-file=./my.cnf --user=mysql
  13. select version();

到此,關(guān)于“怎么用源碼安裝MYSQL”的學(xué)習(xí)就結(jié)束了,希望能夠解決大家的疑惑。理論與實(shí)踐的搭配能更好的幫助大家學(xué)習(xí),快去試試吧!若想繼續(xù)學(xué)習(xí)更多相關(guān)知識(shí),請(qǐng)繼續(xù)關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司網(wǎng)站,小編會(huì)繼續(xù)努力為大家?guī)?lái)更多實(shí)用的文章!

分享標(biāo)題:怎么用源碼安裝MYSQL-創(chuàng)新互聯(lián)
當(dāng)前地址:http://aaarwkj.com/article18/ccjhgp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供企業(yè)建站、營(yíng)銷型網(wǎng)站建設(shè)、網(wǎng)站策劃、App開(kāi)發(fā)、自適應(yīng)網(wǎng)站、網(wǎng)站導(dǎo)航

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

商城網(wǎng)站建設(shè)
国产成人精品久久一区二区| 国产一区二区爽爽爽视频| 手机看片黄色福利视频91| 日本精品视频一区二区三区| 亚洲av天堂在线播放| 久久精品二区亚洲w码| 日韩欧美国产综合一区二区| 国产三级黄在线观看| 亚洲欧美日韩综合精品久久| 国产黄片a三级久久久久久| 免费可以看的黄片欧美| 久久久久久狠狠亚洲综合| 亚洲国产精品伦理在线看| 欧美日韩亚洲国产专区精品| 风韵犹存丰满大屁股熟妇| 欧美日韩黄色在线观看| 中文字幕日韩不卡顿一区二区| 情侣自拍偷拍亚洲天堂区| 最新日韩欧美一区二区| 亚洲午夜精品理论在线不卡| 亚洲天堂,男人的天堂| 日韩成人激情在线观看| 一区二区日韩欧美国产| 欧美日韩另类国产综合| 欧美日韩在线视频第三区| 免费看真人性生活视频| 中文字幕乱码高清欧美日韩| 国产免费一区二区福利| 日本av成人激情视频| 麻豆av永久地址久久精品| 国产一区二区三区百合| 美女爽到高潮久久久| 欧美一区二区三区成人网| 亚洲高清成人在线观看| 91福利免费在线看| 午夜夫妻生活视频在线观看 | 一区二区三区乱码国产| 午夜啪视频免费在线观看| 国产无套内射三级视频| 日韩色图在线观看视频| 夫妻性生活黄色录像视频|