压在透明的玻璃上c-国产精品国产一级A片精品免费-国产精品视频网-成人黄网站18秘 免费看|www.tcsft.com

MySql安裝教程

 

  一、下載Mysql

  http://mirrors.sohu.com/  —-搜狐開源鏡像站

  http://mirrors.163.com/   —-網易開源鏡像站

  [root@localhost src]# pwd

  /usr/local/src

  [root@localhost src]# wget http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.73.tar.gz

  –2015-01-06 22:30:03–  http://mirrors.sohu.com/mysql/MySQL-5.1/mysql-5.1.73.tar.gz

  Resolving mirrors.sohu.com… 119.188.36.70

  Connecting to mirrors.sohu.com|119.188.36.70|:80… connected.

  HTTP request sent, awaiting response… 200 OK

  Length: 24023347 (23M) [application/octet-stream]

  Saving to: “mysql-5.1.73.tar.gz”

  100%[======================================>] 24,023,347   690K/s   in 56s

  2015-01-06 22:30:58 (422 KB/s) – “mysql-5.1.73.tar.gz” saved [24023347/24023347]

  二、解剛才下載的Mysql包

  [root@localhost src]# ll

  total 23464

  -rw-r–r–. 1 root root 24023347 Nov  5  2013 mysql-5.1.73.tar.gz

  [root@localhost src]# tar zxf mysql-5.1.73.tar.gz

  三、創建Mysql用戶和組

  [root@localhost src]# groupadd -g 400 mysql

  [root@localhost src]# useradd -M -u 400 -g 400 -s /sbin/nologin mysql

  [root@localhost src]# id mysql

  uid=400(mysql) gid=400(mysql) groups=400(mysql)

  四、編譯安裝MySQL

  [root@localhost src]# cd mysql-5.1.73

  [root@localhost mysql-5.1.73]# ./configure –prefix=/usr/local/mysql-5.1.73 –with-unix-socket-path=/usr/local/mysql-5.1.73/tmp/mysql.sock –localstatedir=/usr/local/mysql-5.1.73/data –enable-assembler –enable-thread-safe-client –with-mysqld-user=mysql –with-big-tables –without-debug –with-pthread –with-extra-charsets=complex –with-readline –with-ssl –with-embedded-server –enable-local-infile –with-plugins=partition,innobase –with-mysqld-ldflags=-all-static –with-client-ldflags=-all-static

  ./configure的最后提示信息,出現以下信息表示正確

  Thank you for choosing MySQL!

  Remember to check the platform specific part of the reference manual

  for hints about installing MySQL on your platform.

  Also have a look at the files in the Docs directory.

  錯誤:checking for termcap functions library… configure: error: No curses/termcap library found

  解決:[root@localhost ~]# yum install -y ncurses-devel

  [root@localhost mysql-5.1.73]# make

  make結束后的提示信息如下:

  make[1]: Leaving directory `/usr/local/src/mysql-5.1.73/server-tools'

  Making all in win

  make[1]: Entering directory `/usr/local/src/mysql-5.1.73/win'

  make[1]: Nothing to be done for `all'.

  make[1]: Leaving directory `/usr/local/src/mysql-5.1.73/win'

  [root@localhost mysql-5.1.73]# make install

  make install結束后的提示信息如下:

  make[2]: Leaving directory `/usr/local/src/mysql-5.1.73/win'

  make[1]: Leaving directory `/usr/local/src/mysql-5.1.73/win'

  五、拷貝配置文件及啟動腳本

  [root@localhost mysql-5.1.73]# cp support-files/my-medium.cnf /etc/my.cnf

  [root@localhost mysql-5.1.73]# cp support-files/mysql.server /etc/init.d/mysqld

  [root@localhost mysql-5.1.73]# chmod 700 /etc/init.d/mysqld

  [root@localhost mysql-5.1.73]# chkconfig –add mysqld

  [root@localhost mysql-5.1.73]# chkconfig –list mysqld

  mysqld          0:off   1:off   2:on    3:on    4:on    5:on    6:off

  六、做符號鏈接,便于訪問

  [root@localhost mysql-5.1.73]# ln -s /usr/local/mysql-5.1.73/ /usr/local/mysql

  [root@localhost mysql-5.1.73]# cd /usr/local/mysql

  [root@localhost mysql]# ll

  total 28

  drwxr-xr-x.  2 root root 4096 Jan  6 23:55 bin

  drwxr-xr-x.  3 root root 4096 Jan  6 23:54 include

  drwxr-xr-x.  3 root root 4096 Jan  6 23:54 lib

  drwxr-xr-x.  2 root root 4096 Jan  7 00:08 libexec

  drwxr-xr-x. 10 root root 4096 Jan  7 00:08 mysql-test

  drwxr-xr-x.  6 root root 4096 Jan  7 00:08 share

  drwxr-xr-x.  5 root root 4096 Jan  7 00:08 sql-bench

  七、進行mysql初始化

  [root@localhost mysql]# ./bin/mysql_install_db –user=mysql

  Installing MySQL system tables…

  150107  0:15:52 [Warning] '–skip-locking' is deprecated and will be removed in a future release. Please use '–skip-external-locking' instead.

  OK

  Filling help tables…

  150107  0:15:53 [Warning] '–skip-locking' is deprecated and will be removed in a future release. Please use '–skip-external-locking' instead.

  OK

  [root@localhost mysql]# ll

  total 32

  drwxr-xr-x.  2 root  root 4096 Jan  6 23:55 bin

  drwx——.  4 mysql root 4096 Jan  7 00:15 data

  drwxr-xr-x.  3 root  root 4096 Jan  6 23:54 include

  drwxr-xr-x.  3 root  root 4096 Jan  6 23:54 lib

  drwxr-xr-x.  2 root  root 4096 Jan  7 00:08 libexec

  drwxr-xr-x. 10 root  root 4096 Jan  7 00:08 mysql-test

  drwxr-xr-x.  6 root  root 4096 Jan  7 00:08 share

  drwxr-xr-x.  5 root  root 4096 Jan  7 00:08 sql-bench

  八、設置目錄屬主

  [root@localhost mysql]# chown -R mysql.mysql /usr/local/mysql

  九、以腳本方式進行啟動

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

  [1] 53830

  [root@localhost mysql]# 150107 00:18:37 mysqld_safe Logging to '/usr/local/mysql/data/localhost.err'.

  150107 00:18:37 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data

  —回車

  十、連接數據庫

  [root@localhost mysql]# ./bin/mysql

  Welcome to the MySQL monitor.  Commands end with ; or g.

  Your MySQL connection id is 1

  Server version: 5.1.73-log Source distribution

  Copyright (c) 2000, 2013, 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              |

  | test               |

  +——————–+

  3 rows in set (0.00 sec)

  mysql>

  十一、優化mysql命令路徑

  [root@localhost mysql]# echo "export PATH=$PATH:/usr/local/mysql/bin/">>/etc/profile

  [root@localhost mysql]# source  /etc/profile

  編譯選項詳解:

  –prefix=/usr/local/mysql  ———-設定mysql安裝路徑

  –with-unix-socket-path=/usr/local/mysql/tmp/mysql.sock  —-設定mysql socket文件存放目錄

  –localstatedir=/usr/local/mysql/data   –設定mysql的數據文件存放位置

  –enable-assembler    —–允許匯編模式(優化性能),使用一些字符函數的匯編版本

  –with-mysqld-ldflag=-all-static    —服務器使用靜態庫(優化性能),服務器端鏈接參數,本文示例為指定靜態編譯mysql服務器,(靜態鏈接提高13%性能)

  –with-client-ldflag=-all-static     —客戶端使用靜態庫(優化性能),客戶端鏈接參數,本文示例為指定靜態編譯mysql客戶端,(靜態鏈接提高13%性能)

  –enable-thread-safe-client       –以線程方式編譯客戶端

  –with-mysqld-user=mysql        –指定mysql運行的系統用戶

  –with-big-tables                                  —-在32位平臺上支持大于4G行的表

  –without-debug               —使用非debug模式

  –with-pthread                                      –強制使用pthread線程序庫編譯

  –with-extra-charsets=complex       –服務器需要支持的字符集,有三種可能的值:空格間隔的一系列字符集名;complex ,包括不能動態裝載的所有字符集;all,將所有字符集包括進二進制

  -with-readline

  –with-ssl              —-啟用SSL支持

  -with-embedded-server    —編譯embedded-server,構建嵌入式MySQL庫

  –enable-local-infile —–讓mysql支持從本地文件導入數據庫

  –with-plugins=partition,innobase     —-MySQL服務器端支持的存儲引擎組件(默認為空),可選值較多:

  partition:MySQL Partitioning Support;

  daemon_example:This is an example plugin daemon;

  ftexample:Simple full-text parser plugin;

  archive:Archive Storage Engine;

  blackhole:Basic Write-only Read-never tables;

  csv:Stores tables in text CSV format,強制安裝;

  example:Example for Storage Engines for developers;

  federated:Connects to tables on remote MySQL servers;

  heap:Volatile memory based tables,強制安裝;

  ibmdb2i:IBM DB2 for i Storage Engine;

  innobase:Transactional Tables using InnoDB;

  innodb_plugin:Transactional Tables using InnoDB;

  myisam:Traditional non-transactional MySQL tables,強制安裝;

  myisammrg:Merge multiple MySQL tables into one,強制安裝;

  ndbcluster:High Availability Clustered tables;)

 

上一篇:安卓防火墻 PS DroidWall

下一篇:extmail 批量導入用戶的程序使用說明

站长统计