91超碰碰碰碰久久久久久综合_超碰av人澡人澡人澡人澡人掠_国产黄大片在线观看画质优化_txt小说免费全本

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

RedHat 6.7 安裝Mysql 5.7.18

發布時間:2020-06-11 23:55:33 來源:網絡 閱讀:2523 作者:yuri_cto 欄目:MySQL數據庫

環境準備:

操作系統:RedHat 6.7

數據庫:Mysql 5.7.18


1.從官網下載  mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz

官網地址:http://dev.mysql.com/downloads/mysql/


2. 創建mysql的用戶組/用戶, data目錄及其用戶目錄

mkdir /home/mysql

mkdir /mysql_data

groupadd -g 505 mysql

useradd  -u 506  -g mysql  -s  /bin/false -d  /home/mysql  mysql 


3. 解壓安裝包并將解壓包里的內容拷貝到mysql的安裝目錄/home/mysql

tar -xvf mysql-5.7.18-linux-glibc2.5-x86_64.tar.gz  -C /home/mysql/

cd  /home/mysql

mv mysql-5.7.18-linux-glibc2.5-x86_64  mysql

cd mysql

mv * ../

chown mysql:mysql -R /home/mysql

chown mysql:mysql -R /mysql_data

chmod 750 -R /home/mysql

chmod 750 -R /home/mysql_data



4.初始化數據庫

vim  mysql.server

將啟動腳本里面的basedir和datadir修改成我們指定的目錄

basedir=/home/mysql

datadir=/mysql_data


[root@iccsdb02 mysql]# ./bin/mysqld --user=mysql --basedir=/home/mysql --datadir=/mysql_data --initialize

2017-04-26T02:17:42.485369Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2017-04-26T02:17:43.083466Z 0 [Warning] InnoDB: New log files created, LSN=45790

2017-04-26T02:17:43.236539Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.

2017-04-26T02:17:43.357511Z 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: 87cd07e3-2a26-11e7-afe5-0800275a2175.

2017-04-26T02:17:43.385762Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.

2017-04-26T02:17:43.387836Z 1 [Note] A temporary password is generated for root@localhost: 9NuZjvE>fsZb


改用 mysqld --initialize 后,如果 datadir 指向的目標目錄下已經有數據文件, 會出現warning 報錯 如下:

刪除清空后在重新初始化即可

2017-04-24T08:51:45.724122Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

2017-04-24T08:51:45.727068Z 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.

2017-04-24T08:51:45.727113Z 0 [ERROR] Aborting


5. 檢測下是否能啟動mysql服務

# cd /home/mysql/support-files

[root@iccsdb02 support-files]# ./mysql.server  start

Starting MySQL.Logging to '/mysql_data/iccsdb02.err'.

                                                           [確定]


如果出現如下報錯:

Starting MySQL.2017-04-25T03:03:32.124076Z mysqld_safe Directory '/var/lib/mysql' for UNIX socket file don't exists.

The server quit without updating PID file (/var/lib/mysql/i[失敗]1.pid).

檢查/etc/my.cnf 文件查看datadir等是否正確,默認是沒有這個配置文件的,后續我們可能需要手動添加。



6. 創建軟鏈接

ln -s /home/mysql/bin/mysql       /usr/bin/mysql

ln -s /home/mysql/bin/mysqladmin  /usr/bin/mysqladmin


7. 配置mysql服務開機自動啟動

拷貝啟動文件到/etc/init.d/下并重命令為mysqld

# cp /home/mysql/support-files/mysql.server /etc/init.d/mysqld


增加執行權限

# chmod 755 /etc/init.d/mysqld


檢查自啟動項列表中沒有mysqld這個,如果沒有就添加mysqld:

# chkconfig --list mysqld

# chkconfig --add mysqld


設置MySQL在345等級自動啟動

# chkconfig --level 35 mysqld on


8. mysql服務的啟動/重啟/停止,其實到此mysql應該就已經能夠正常啟動了


啟動mysql服務

# service mysqld start


停止mysql服務

# service mysqld stop


重啟mysql服務

# service mysqld restart


9. 創建配置文件

將默認my.cnf備份,如果有的話

# mv /etc/my.cnf /etc/my.cnf.bak


進入mysql的安裝目錄支持文件目錄


# cd /home/mysql/support-files  

# cp my-default.cnf /etc/my.cnf 這步驟在此版本的軟件里面沒有看到相對應的my-default.cnf文件

可按需修改新的配置文件選項, 不修改配置選項, mysql則按默認配置參數運行. 


默認/etc/my.cnf 是沒有的,可以自己創建個也可以從網上下載一個,這里設置編碼為utf8以防亂碼,我測試的配置文件如下:


[mysqld]

datadir=/my_data

socket=/var/lib/mysql/mysql.sock

user=mysql

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0


character_set_server=utf8

init_connect='SET NAMES utf8'


[mysqld_safe]

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid


[client]

default-character-set=utf8


10. 初始化mysql用戶root的密碼, 網上說的方法有很多,但是經過測試都怎么好用,所以就直接按照這個來了


修改MySQL的配置文件(默認為/etc/my.cnf),在[mysqld]下添加一行skip-grant-tables


service mysqld restart后,即可直接用mysql進入

[root@iccsdb02 run]# mysql

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

Your MySQL connection id is 3

Server version: 5.7.18 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> 

mysql> update mysql.user set authentication_string=password('1q2w3e') where user='root' and Host = 'localhost';

Query OK, 1 row affected, 1 warning (0.12 sec)

Rows matched: 1  Changed: 1  Warnings: 1

mysql> flush privileges;

Query OK, 0 rows affected (0.03 sec)

mysql> quit


再次進入還會提示你修改密碼

root@iccsdb02 run]# mysql -u root -p

Enter password: 

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

Your MySQL connection id is 4

Server version: 5.7.18


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> show databases;

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql> 


重新更新一下密碼即可

[root@iccsdb02 mysql]# mysqladmin -u root -p password

Enter password: 

New password: 

Confirm new password: 

Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.

[root@iccsdb02 mysql]# 


[root@iccsdb02 mysql]# mysql -u root -p

Enter password: 

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

Your MySQL connection id is 7

Server version: 5.7.18 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> show databases;

+--------------------+

| Database           |

+--------------------+

| information_schema |

| mysql              |

| performance_schema |

| sys                |

+--------------------+

4 rows in set (0.00 sec)


mysql> 


好了,到此mysql 5.7.18 就已經安裝成功并且本地能正常訪問使用了

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

儋州市| 河北区| 平邑县| 永安市| 玉龙| 雅安市| 富宁县| 汉中市| 从化市| 黎城县| 礼泉县| 五大连池市| 凯里市| 牡丹江市| 紫阳县| 涞源县| 沂水县| 东乡| 漠河县| 九寨沟县| 满洲里市| 寻乌县| 东阿县| 松阳县| 汉寿县| 衡东县| 桂东县| 洛阳市| 内乡县| 太原市| 军事| 东方市| 儋州市| 南漳县| 建宁县| 兴隆县| 阳东县| 浏阳市| 景宁| 宜阳县| 中山市|