最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

RHEL6.2編譯安裝MySQL 5.6.16過(guò)程分享

 更新時(shí)間:2014年07月17日 09:12:34   投稿:junjie  
這篇文章主要介紹了RHEL6.2編譯安裝MySQL 5.6.16過(guò)程分享,還包括了mysql_secure_installation腳本運(yùn)行指導(dǎo),需要的朋友可以參考下

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

復(fù)制代碼 代碼如下:

[root@beanvm ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.2 (Santiago)
[root@beanvm ~]# uname -a
Linux beanvm 2.6.32-220.el6.i686 #1 SMP Wed Nov 9 08:02:18 EST 2011 i686 i686 i386 GNU/Linux

二、準(zhǔn)備工作與系統(tǒng)配置

1.下載安裝包

這里下載的是較新的MySQL 5.6.16版本,更新迭代的太快了,文件為:mysql-5.6.16.tar.gz

下載地址:http://dev.mysql.com/downloads/mysql/

2. 安裝編譯必須的包

復(fù)制代碼 代碼如下:

[root@beanvm ~]# rpm -ivh bison-devel-2.4.1-5.el6.i686.rpm
warning: bison-devel-2.4.1-5.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:bison-devel            ########################################### [100%]
[root@beanvm ~]# rpm -ivh ncurses-devel-5.7-3.20090208.el6.i686.rpm
warning: ncurses-devel-5.7-3.20090208.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Preparing...                ########################################### [100%]
   1:ncurses-devel          ########################################### [100%]

個(gè)人經(jīng)驗(yàn)上面兩個(gè)包是比較容易缺失,像gcc,make,cmake則是必備的了,也建議檢查一下:

復(fù)制代碼 代碼如下:

[root@beanvm ~]# rpm -qa |grep gcc-c++
gcc-c++-4.4.6-3.el6.i686
[root@beanvm ~]# rpm -qa |grep make
imake-1.0.2-11.el6.i686
automake-1.11.1-1.2.el6.noarch
cmake-2.6.4-5.el6.i686
make-3.81-19.el6.i686

3.創(chuàng)建MySQL用戶(hù)和組

復(fù)制代碼 代碼如下:

[root@beanvm ~]# groupadd mysql
[root@beanvm ~]# useradd -g mysql mysql
[root@beanvm ~]# passwd mysql

4.配置環(huán)境變量

復(fù)制代碼 代碼如下:

[root@beanvm ~]# su – mysql

在.bash_profile文件中為PATH變量追加mysql路徑:

復(fù)制代碼 代碼如下:
export PATH=/sbin:$HOME/bin:/usr/local/mysql/bin:$PATH

三、安裝MySQL

解壓安裝包:

復(fù)制代碼 代碼如下:
[root@beanvm ~]# tar -xvf mysql-5.6.16.tar.gz
[root@beanvm ~]# cd mysql-5.6.16

編譯腳本如下:

復(fù)制代碼 代碼如下:

cmake \
# MySQL根目錄
-DCMAKE_INSTALL_PREFIX=/usr/local/mysql \
# 數(shù)據(jù)文件目錄
-DMYSQL_DATADIR=/usr/local/mysql/data \
-DSYSCONFDIR=/etc \
-DWITH_MYISAM_STORAGE_ENGINE=1 \
-DWITH_INNOBASE_STORAGE_ENGINE=1 \
-DWITH_MEMORY_STORAGE_ENGINE=1 \
-DWITH_READLINE=1 \
-DMYSQL_UNIX_ADDR=/var/lib/mysql/mysql.sock \
-DMYSQL_TCP_PORT=3306 \
-DENABLED_LOCAL_INFILE=1 \
-DWITH_PARTITION_STORAGE_ENGINE=1 \
-DEXTRA_CHARSETS=all \
-DDEFAULT_CHARSET=utf8 \
-DDEFAULT_COLLATION=utf8_general_ci

make && make install

基本上安裝的選項(xiàng)還是一目了然的,更多的選項(xiàng)示意參見(jiàn):

http://dev.mysql.com/doc/refman/5.6/en/source-configuration-options.html

編譯時(shí)間是機(jī)器而定,我的有20多分鐘的樣子。

安裝完成后要給根目錄指定為mysql用戶(hù)和組,也可以在這時(shí)候進(jìn)行mysql用戶(hù)和組的創(chuàng)建工作:

復(fù)制代碼 代碼如下:

[root@beanvm ~]# chown -R mysql:mysql /usr/local/mysql

安裝完成的MySQL根目錄如下:

復(fù)制代碼 代碼如下:

[root@beanvm ~]# ls -l /usr/local/mysql/
total 164
drwxr-xr-x.  2 mysql mysql  4096 Feb 15 14:40 bin
-rw-r--r--.  1 mysql mysql 17987 Jan 14 23:38 COPYING
drwxr-xr-x.  6 mysql mysql  4096 Feb 18 16:32 data
drwxr-xr-x.  2 mysql mysql  4096 Feb 15 14:39 docs
drwxr-xr-x.  3 mysql mysql  4096 Feb 15 14:39 include
-rw-r--r--.  1 mysql mysql 88109 Jan 14 23:38 INSTALL-BINARY
drwxr-xr-x.  3 mysql mysql  4096 Feb 15 14:39 lib
drwxr-xr-x.  4 mysql mysql  4096 Feb 15 14:40 man
-rw-r--r--.  1 mysql mysql   943 Feb 15 14:56 my.cnf
-rw-r--r--.  1 mysql mysql   943 Feb 18 16:26 my-new.cnf
drwxr-xr-x. 10 mysql mysql  4096 Feb 15 14:40 mysql-test
-rw-r--r--.  1 mysql mysql  2496 Jan 14 23:38 README
drwxr-xr-x.  2 mysql mysql  4096 Feb 15 14:40 scripts
drwxr-xr-x. 28 mysql mysql  4096 Feb 15 14:40 share
drwxr-xr-x.  4 mysql mysql  4096 Feb 15 14:40 sql-bench
drwxr-xr-x.  3 mysql mysql  4096 Feb 15 14:40 support-files

可以看到已經(jīng)創(chuàng)建一個(gè)默認(rèn)的配置文件my.cnf。

四、MySQL初始化

執(zhí)行初始化腳本來(lái)創(chuàng)建數(shù)據(jù)庫(kù):

復(fù)制代碼 代碼如下:

[root@beanvm ~]# cd /usr/local/mysql/scripts/
[root@beanvm scripts]# ./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data

創(chuàng)建MySQL服務(wù)并啟動(dòng):

復(fù)制代碼 代碼如下:

[root@beanvm ~]# cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql
[root@beanvm ~]# service mysql start
Starting MySQL.. SUCCESS!

接下來(lái)就是配置數(shù)據(jù)庫(kù)了,在新版的MySQL安裝過(guò)程中提供了一個(gè)腳本用于自動(dòng)完成數(shù)據(jù)庫(kù)使用前的配置工作,這個(gè)腳本位于/usr/local/mysql/bin/mysql_secure_installation,它會(huì)完成以下任務(wù):


1.指定root用戶(hù)密碼(默認(rèn)是沒(méi)有密碼的)
2.刪除匿名用戶(hù)
3.設(shè)置root用戶(hù)的遠(yuǎn)程訪(fǎng)問(wèn)(對(duì)應(yīng)的要在防火墻中開(kāi)啟3306端口)
4.是否刪除測(cè)試數(shù)據(jù)庫(kù)
5.重載權(quán)限表

這里建議使用這個(gè)腳本,執(zhí)行過(guò)程如下:

復(fù)制代碼 代碼如下:

[mysql@beanvm ~]$ /usr/local/mysql/bin/mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] n
 ... skipping.

By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] n
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Cleaning up...

當(dāng)然也可以手動(dòng)完成這些操作:

復(fù)制代碼 代碼如下:

[mysql@beanvm ~]$ mysqladmin -u root password 'new-password'
[mysql@beanvm ~]$ mysqladmin -u root -h beanvm password 'new-password'
[mysql@beanvm ~]$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 5.6.16 Source distribution

Copyright (c) 2000, 2014, 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> delete from mysql.user where user='';
Query OK, 2 rows affected (0.01 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mypasswd' WITH GRANT OPTION;
Query OK, 0 rows affected (0.01 sec)

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


相關(guān)文章

  • 簡(jiǎn)單了解 MySQL 中相關(guān)的鎖

    簡(jiǎn)單了解 MySQL 中相關(guān)的鎖

    這篇文章主要介紹了簡(jiǎn)單了解 MySQL 中相關(guān)的鎖,重點(diǎn)介紹InnoDB中的鎖相關(guān)知識(shí),包括鎖的概念及分類(lèi)解析,對(duì)MySQL鎖相關(guān)感興趣的朋友跟隨小編一起看看吧
    2021-05-05
  • mysql 觸發(fā)器用法實(shí)例詳解

    mysql 觸發(fā)器用法實(shí)例詳解

    這篇文章主要介紹了mysql 觸發(fā)器用法實(shí)例詳解的相關(guān)資料,需要的朋友可以參考下
    2017-06-06
  • mysql數(shù)據(jù)庫(kù)優(yōu)化總結(jié)(心得)

    mysql數(shù)據(jù)庫(kù)優(yōu)化總結(jié)(心得)

    本篇文章是對(duì)mysql數(shù)據(jù)庫(kù)優(yōu)化進(jìn)行了詳細(xì)的總結(jié)與介紹,需要的朋友參考下
    2013-06-06
  • mysql數(shù)據(jù)庫(kù)鎖的產(chǎn)生原因及解決辦法

    mysql數(shù)據(jù)庫(kù)鎖的產(chǎn)生原因及解決辦法

    這篇文章主要介紹了mysql數(shù)據(jù)庫(kù)鎖的產(chǎn)生原因及解決辦法,需要的朋友可以參考下
    2016-01-01
  • MySQL存儲(chǔ)引擎簡(jiǎn)介及MyISAM和InnoDB的區(qū)別

    MySQL存儲(chǔ)引擎簡(jiǎn)介及MyISAM和InnoDB的區(qū)別

    這篇文章主要介紹了MySQL存儲(chǔ)引擎簡(jiǎn)介及MyISAM和InnoDB的區(qū)別,重點(diǎn)介紹了MyISAM 和 InnoDB的區(qū)別,需要的朋友可以參考下
    2014-05-05
  • MySQL子查詢(xún)的使用詳解上篇

    MySQL子查詢(xún)的使用詳解上篇

    子查詢(xún)是在查詢(xún)語(yǔ)句里面再嵌套一個(gè)查詢(xún),這是因?yàn)槲覀冊(cè)谔崛?shù)據(jù)的時(shí)候有很多不知道的數(shù)據(jù)產(chǎn)生了依賴(lài)關(guān)系。本文為大家總結(jié)了一下MySQL數(shù)據(jù)庫(kù)子查詢(xún)語(yǔ)法規(guī)則,感興趣的可以了解一下
    2022-08-08
  • MySQL優(yōu)化之分區(qū)表

    MySQL優(yōu)化之分區(qū)表

    這篇文章主要介紹了MySQL優(yōu)化之分區(qū)表,需要的朋友可以參考下
    2016-06-06
  • MySQL視圖簡(jiǎn)介及基本操作教程

    MySQL視圖簡(jiǎn)介及基本操作教程

    這篇文章主要給大家介紹了關(guān)于MySQL視圖簡(jiǎn)介及基本操作的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家學(xué)習(xí)或者使用MySQL具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-04-04
  • CentOS7環(huán)境下源碼安裝MySQL5.7的方法

    CentOS7環(huán)境下源碼安裝MySQL5.7的方法

    這篇文章主要介紹了CentOS7環(huán)境下源碼安裝MySQL5.7的方法,結(jié)合實(shí)例形式分析了CentoS7環(huán)境下MySQL5.7的下載、編譯、安裝、設(shè)置等相關(guān)操作技巧,需要的朋友可以參考下
    2018-03-03
  • MySQL分區(qū)表的局限和限制詳解

    MySQL分區(qū)表的局限和限制詳解

    本文對(duì)Mysql分區(qū)表的局限性做了一些總結(jié),因?yàn)閭€(gè)人能力以及測(cè)試環(huán)境的 原因,有可能有錯(cuò)誤的地方,還請(qǐng)大家看到能及時(shí)指出,當(dāng)然有興趣的朋友可以去官方網(wǎng)站查閱。
    2017-03-03

最新評(píng)論

呼图壁县| 河北省| 东方市| 普定县| 大连市| 东明县| 蓝山县| 安溪县| 仪陇县| 崇仁县| 扎兰屯市| 当涂县| 开封市| 苗栗县| 日土县| 隆安县| 伊金霍洛旗| 鄂伦春自治旗| 宁河县| 临海市| 历史| 思南县| 兴海县| 寿光市| 桐城市| 天门市| 三河市| 琼中| 南平市| 琼中| 海晏县| 滁州市| 五台县| 涟水县| 浏阳市| 株洲市| 涟源市| 瓦房店市| 江陵县| 临西县| 静乐县|