成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

CentOS6.3安裝MySQL-5.7.10

MySQL的安裝分為三種:
1、RPM包安裝;
2、二進(jìn)制包安裝;
3、源碼安裝。

第一種方式比較簡單,直接RPM包安裝就OK了,或者通過yum源來安裝,但無法自定義安裝目錄。
而第三種方式比較復(fù)雜。
一般項(xiàng)目中使用比較多的是通過二進(jìn)制包來安裝,這種安裝方式可以根據(jù)企業(yè)的不同需求進(jìn)行相關(guān)的自定義配置,比如安裝在哪個(gè)目錄,如何配置等。
MySQL5.7與5.6安裝有所改變。
CentOS版本
[mysql@new ~]$ cat /etc/redhat-release
CentOS release 6.3 (Final)
[mysql@new ~]$
把安裝文件上傳至服務(wù)器
[mysql@new ~]$ ls
total 535920
-rw-rw-rw-. 1 mysql mysql 548774698 Jan 12 16:53 mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz
解壓安裝文件
[mysql@new ~]$ tar -xvf mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz
重命名目錄
[mysql@guoqing ~]$ mv mysql-5.7.10-linux-glibc2.5-x86_64 mysql
[mysql@guoqing ~]$ ls
mysql  mysql-5.7.10-linux-glibc2.5-x86_64.tar.gz
[mysql@guoqing ~]$ cd mysql
[mysql@guoqing mysql]$ ls
bin  COPYING  docs  include  INSTALL-BINARY  lib  man  README  share  support-files

新建存放數(shù)據(jù)的目錄data
[mysql@guoqing mysql]$ mkdir data
[mysql@guoqing mysql]$ ll
total 164
drwxr-xr-x.  2 mysql mysql   4096 Nov 30 03:54 bin
-rw-r--r--.  1 mysql mysql  17987 Nov 30 03:16 COPYING
drwxrwxr-x.  2 mysql mysql   4096 Jan 12 23:38 data
drwxr-xr-x.  2 mysql mysql   4096 Nov 30 03:54 docs
drwxr-xr-x.  3 mysql mysql   4096 Nov 30 03:54 include
-rw-r--r--.  1 mysql mysql 108090 Nov 30 03:26 INSTALL-BINARY
drwxr-xr-x.  5 mysql mysql   4096 Nov 30 03:54 lib
drwxr-xr-x.  4 mysql mysql   4096 Nov 30 03:54 man
-rw-r--r--.  1 mysql mysql   2478 Nov 30 03:16 README
drwxr-xr-x. 28 mysql mysql   4096 Nov 30 03:54 share
drwxr-xr-x.  2 mysql mysql   4096 Nov 30 03:54 support-files        

拷貝my.cnf文件
[mysql@guoqing mysql]$ su
Password:

[root@guoqing mysql]# cp support-files/my-default.cnf /etc/
[root@guoqing mysql]# chown mysql.mysql /etc/my.cnf

拷貝MySQL服務(wù)文件
[root@guoqing mysql]# cp support-files/mysql.server /etc/init.d/mysql
 
在MySQL服務(wù)文件中把/usr/local/指替換成自己安裝MySQL目錄
這里是替換成的home/mysql
[root@guoqing mysql]# vi /etc/init.d/mysql
# 0 means don't wait at all
# Negative numbers mean to wait indefinitely
service_startup_timeout=900
# Lock directory for RedHat / SuSE.
lockdir='/var/lock/subsys'
lock_file_path="$lockdir/mysql"
# The following variables are only set for letting mysql.server find things.
# Set some defaults
mysqld_pid_file_path=
if test -z "$basedir"
then
  basedir=/home/mysql/mysql
  bindir=/home/mysql/mysql/bin
  if test -z "$datadir"
  then
    datadir=/home/mysql/mysql/data
  fi
  sbindir=/home/mysql/mysql/bin
  libexecdir=/home/mysql/mysql/bin
else
  bindir="$basedir/bin"
  if test -z "$datadir"
  then
    datadir="$basedir/data"
  fi
  sbindir="$basedir/sbin"
  libexecdir="$basedir/libexec"
fi
# datadir_set is used to determine if datadir was set (and so should be
# *not* set inside of the --basedir= handler.)
datadir_set=
#
# Use LSB init script functions for printing messages, if possible
#
lsb_functions="/lib/lsb/init-functions"
if test -f $lsb_functions ; then
  . $lsb_functions
else
"/etc/rc.d/init.d/mysql" 393L, 10981C written
[root@guoqing mysql]# exit
exit
修改my.cnf文件,主要添加basedir、datadir
[mysql@guoqing mysql]$ vi /etc/my.cnf
[mysqld]
basedir=/home/mysql/mysql
datadir=/home/mysql/mysql/data
socket=/home/mysql/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
[mysqld_safe]
log-error=/home/mysql/mysql/data/mysqld.log
pid-file=/home/mysql/mysql/data/mysqld/mysqld.pid
"/etc/my.cnf" 11L, 316C written                                                  

初始化MySQL
MySQL 5.7.6之后版本為 ./bin/mysqld --initialize --user=mysql --basedir=/home/mysql/mysql --datadir=/home/mysql/mysql/data/
[mysql@guoqing mysql]$ ./bin/mysqld --initialize --user=mysql --basedir=/home/mysql/mysql --datadir=/home/mysql/mysql/data/
2016-01-12T16:16:14.765586Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2016-01-12T16:16:14.765847Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2016-01-12T16:16:14.766086Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2016-01-12T16:16:15.038567Z 0 [Warning] InnoDB: New log files created, LSN=45790
2016-01-12T16:16:15.095995Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2016-01-12T16:16:15.166081Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: cdd34871-b947-11e5-8a45-0800272a2c8e.
2016-01-12T16:16:15.168260Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2016-01-12T16:16:15.168776Z 1 [Note] A temporary password is generated for root@localhost: qnW8usF=o;=e(root用戶密碼)
 MySQL 5.7.6之前的版本為bin/mysql_install_db --user=mysql   

創(chuàng)建 SSL/RSA 文件
參見:http://dev.mysql.com/doc/refman/5.7/en/mysql-ssl-rsa-setup.html
[mysql@guoqing mysql]$ bin/mysql_ssl_rsa_setup --datadir=/home/mysql/mysql/data/
Generating a 2048 bit RSA private key
...............................+++
.............................................................................................................................................+++
writing new private key to 'ca-key.pem'
-----
Generating a 2048 bit RSA private key
............................................+++
...................................+++
writing new private key to 'server-key.pem'
-----
Generating a 2048 bit RSA private key
...........................................................................................................................................+++
......+++
writing new private key to 'client-key.pem'
-----
添加環(huán)境變量:/home/mysql/mysql/bin
[mysql@guoqing ~]$ vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin:/home/mysql/mysql/bin
export PATH
~
".bash_profile" 12L, 198C written                                                                             

使變量生效
[mysql@guoqing ~]$ . .bash_profile

啟動(dòng)MySQL服務(wù)
[mysql@new ~]$ service mysql start
Starting MySQL.                                            [  OK  ]

登錄
用到上面日志中的密碼,注意qnW8usF=o;=e全是密碼內(nèi)容
[mysql@guoqing ~]$ mysql -uroot  -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.7.10
Copyright (c) 2000, 2015, 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> set password=password('root');
Query OK, 0 rows affected, 1 warning (0.00 sec)

mysql>

至此,MySQL5.7.10安裝完成,整體與5.6安裝差別不大,便要注意root密碼的長度,初始化方式等。

本文名稱:CentOS6.3安裝MySQL-5.7.10
文章起源:http://jinyejixie.com/article32/jjijpc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供用戶體驗(yàn)、做網(wǎng)站網(wǎng)站排名、ChatGPT、品牌網(wǎng)站建設(shè)微信公眾號(hà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í)需注明來源: 創(chuàng)新互聯(lián)

成都做網(wǎng)站
阜新市| 莫力| 香港 | 子长县| 桐柏县| 华宁县| 康定县| 平阳县| 芷江| 南昌县| 介休市| 临沧市| 安丘市| 紫云| 嘉峪关市| 闽侯县| 五常市| 白城市| 敖汉旗| 东海县| 青田县| 富阳市| 乡宁县| 察隅县| 昭平县| 肥西县| 灵丘县| 乐都县| 林口县| 布尔津县| 南川市| 扎赉特旗| 固原市| 连云港市| 卢湾区| 微博| 宾阳县| 尼木县| 铁力市| 青岛市| 灵川县|