Centos 6.5 安裝mysql 5.7.18

來源:互聯網
上載者:User

標籤:exist   lib   constrain   open   existing   support   ogg   ini   Owner   

1,首先在MySQL官網下載MySQL 5.7.18

2安裝mysql

首先安裝依賴包:yum install  libaio -y

建立MySQL使用者和組

groupadd mysql

useradd mysql -g mysql

建立MySQL安裝目錄

解壓MySQL到安裝目錄

建立資料目錄和授權

cd /usr/local/mysql

mkdir var && mkdir data

cd /usr/local

chmod -R 755 mysql/

chown root:mysql mysql/

cd mysql

chown -R mysql:mysql *

初始化MySQL

[[email protected] mysql]# ./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
2017-05-04T22:46:35.096810Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-05-04T22:46:36.171880Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-05-04T22:46:37.553352Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-05-04T22:46:37.777380Z 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: 883ca086-311b-11e7-bd73-080027e6059a.
2017-05-04T22:46:37.808310Z 0 [Warning] Gtid table is not ready to be used. Table ‘mysql.gtid_executed‘ cannot be opened.
2017-05-04T22:46:39.739908Z 0 [Warning] CA certificate ca.pem is self signed.
2017-05-04T22:46:39.946178Z 1 [Note] A temporary password is generated for [email protected]: >Wd7Uav4layt

注意:>Wd7Uav4layt是root的臨時密碼。

啟動MySQL

[[email protected] mysql]# ./support-files/mysql.server start
Starting MySQL.Logging to ‘/usr/local/mysql/data/MySQL.err‘.
. SUCCESS!

加入系統服務

[[email protected] mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[[email protected] mysql]#
[[email protected] mysql]#
[[email protected] mysql]# chmod +x /etc/init.d/mysqld
[[email protected] mysql]# /etc/init.d/mysqld restart
Shutting down MySQL.. SUCCESS!
Starting MySQL. SUCCESS!

修改MySQL密碼

[[email protected] mysql]# /usr/local/mysql/bin/mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.18-enterprise-commercial-advanced-log

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> set password=password(‘mima666‘);
Query OK, 0 rows affected, 1 warning (0.01 sec)

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

用戶端啟動

[[email protected] mysql]# ln -s /usr/local/mysql/bin/* /usr/bin/

 

 

Centos 6.5 安裝mysql 5.7.18

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.