這篇文章主要為大家展示了“MySQL怎么樣進(jìn)行安裝”,內(nèi)容簡而易懂,條理清晰,希望能夠幫助大家解決疑惑,下面讓小編帶領(lǐng)大家一起研究并學(xué)習(xí)一下“mysql怎么樣進(jìn)行安裝”這篇文章吧。
在成都做網(wǎng)站、成都網(wǎng)站制作過程中,需要針對(duì)客戶的行業(yè)特點(diǎn)、產(chǎn)品特性、目標(biāo)受眾和市場情況進(jìn)行定位分析,以確定網(wǎng)站的風(fēng)格、色彩、版式、交互等方面的設(shè)計(jì)方向。創(chuàng)新互聯(lián)建站還需要根據(jù)客戶的需求進(jìn)行功能模塊的開發(fā)和設(shè)計(jì),包括內(nèi)容管理、前臺(tái)展示、用戶權(quán)限管理、數(shù)據(jù)統(tǒng)計(jì)和安全保護(hù)等功能。
一、下載安裝包
1,下載hive http://mirrors.hust.edu.cn/apache/ 得到apache-hive-1.1.0.tar.gz ,放到該目錄下 /home/
2,下載mysql https://dev.mysql.com/downloads/file/?id=471503得到
我的linux版本是6.8,下載時(shí)最好選擇glib版本,如果下載其它各種組合包,會(huì)提示各種依賴關(guān)系,比較麻煩
拷貝到該目錄下/mysql/
二、安裝mysql
1.卸載系統(tǒng)自帶的mysql相關(guān)安裝包,僅卸載 mysql 開頭的包
rpm -qa | grep -i mysql
rpm -ev mysql-community-libs-5.7.19-1.el7.x86_64 --nodeps
2.創(chuàng)建用戶和組
groupadd mysql
useradd -r -g mysql mysql
3.安裝
解壓tar -zxvf mysql-5.7.19-linux-glibc2.12-x86_64.tar.gz -C ../usr/local
修改目錄[root@hadoop local]# mv mysql-5.7.19-linux-glibc2.12-x86_64/ mysql
添加授權(quán)[root@hadoop mysql]# chown -R mysql.mysql /usr/local/mysql
新建data目錄[root@hadoop mysql]# mkdir data
4.安裝./bin/mysqld --initialize --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data
注意最后一行,這也是和之有版本不同的地方,它給了root一個(gè)初始密碼,此root為mysql的root用戶,后面要登錄的時(shí)候要用到這個(gè)密碼。#H#,?*Els4G&
4.將mysql/目錄下除了data/目錄的所有文件,改回root用戶所有,mysql用戶只需作為mysql/data/目錄下所有文件的所有者。
[root@hadoop mysql]# chown -R root .
[root@hadoop mysql]# chown -R mysql data
5.創(chuàng)建tmp文件夾,并授權(quán)
[root@hadoop mysql]# mkdir tmp
[root@hadoop mysql]# chown -R mysql:mysql tmp
6.復(fù)制并編輯配置文件
[root@hadoop etc]# cp my.cnf.rpmsave my.cnf
[root@hadoop etc]# vi my.cnf
7.添加以下內(nèi)容
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
socket = /usr/local/mysql/tmp/mysql.sock
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
8.將mysql.server拷貝到/etc/init.d/mysql
[root@hadoop support-files]# cp mysql.server /etc/init.d/mysql
[root@hadoop init.d]# chmod +x mysql
9.把mysql注冊(cè)為開機(jī)啟動(dòng)的服務(wù)
[root@hadoop init.d]# chkconfig --add mysql
[root@hadoop init.d]# chkconfig --list mysql
mysql 0:off 1:off 2:on 3:on 4:on 5:on 6:off
10.啟動(dòng)
[root@hadoop init.d]# /etc/init.d/mysql start
Starting MySQL.Logging to '/usr/local/mysql/data/hadoop.err'.
. [ OK ]
11.修改環(huán)境變量
export PATH=$PATH:$HADOOP_HOME/bin:$HADOOP_HOME/sbin:/usr/local/mysql:/usr/local/mysql/bin
[root@hadoop init.d]# source /etc/profile
12.使用root登錄時(shí)報(bào)錯(cuò)
[root@hadoop init.d]# mysql -uroot -p #H#,?*Els4G&
Enter password:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)
13.修改 /etc/my.cnf文件,補(bǔ)充mysql和client配置
[mysqld]
basedir = /usr/local/mysql
datadir = /usr/local/mysql/data
port = 3306
socket = /usr/local/mysql/tmp/mysql.sock
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
skip-grant-tables
[mysql]
default-character-set=utf8
socket = /usr/local/mysql/tmp/mysql.sock
[client]
default-character-set=utf8
socket = /usr/local/mysql/tmp/mysql.sock
14.重新登錄,并輸入新密碼
[root@hadoop etc]# mysql -uroot -p #H#,?*Els4G&
Enter password: mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.19 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, 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>
15.mysql服務(wù)的開啟和關(guān)閉
#/etc/init.d/mysql start 或者 serivce mysql start 或者 bin/mysqld_safe&
#/etc/init.d/mysql stop 或者 service mysql stop 或者 bin/mysqladmin -uroot -p
三、添加hive用戶,會(huì)提示如下錯(cuò)誤
mysql> create user 'hive'@'%' identified by 'hive';
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
強(qiáng)制寫出
mysql> flush privileges;
重新執(zhí)行
mysql> create user 'hive'@'%' identified by 'hive';
Query OK, 0 rows affected (0.00 sec)
mysql> select host,user from user;
+-----------+---------------+
| host | user |
+-----------+---------------+
| % | hive |
| localhost | mysql.session |
| localhost | mysql.sys |
| localhost | root |
+-----------+---------------+
4 rows in set (0.00 sec)
以上是“mysql怎么樣進(jìn)行安裝”這篇文章的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
當(dāng)前文章:mysql怎么樣進(jìn)行安裝
網(wǎng)站路徑:http://jinyejixie.com/article2/ggcjoc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站、網(wǎng)站改版、手機(jī)網(wǎng)站建設(shè)、網(wǎng)站收錄、外貿(mào)網(wǎng)站建設(shè)、企業(yè)建站
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)