62.1 演示環境介紹
- 系統為:RedHat7.2
- 用sudo權限的ec2-user用戶操作
62.2 操作演示
- MySQL5.7.12的RPM包下載
https://downloads.mysql.com/archives/community/
- MySQL安裝包上傳至服務器并解壓
- 注意:解壓出來的檔案中,需要洗掉mysql-community-server-minimal-5.7.12-1.el7.x86_64.rpm,該RPM包和mysql-community-server-5.7.12-1.el7.x86_64.rpm沖突,
[ec2-user@ip-186-31-21-45 mysql5.7.12]$ tar -xvf mysql-5.7.12-1.el7.x86_64.rpm-bundle.tar
[root@ip-186-31-26-102 mysql5.7.12]# ll
total 539776
-rw-r--r-- 1 ec2-user ec2-user 24991304 Mar 29 2016 mysql-community-client-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user 276736 Mar 29 2016 mysql-community-common-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user 3786120 Mar 29 2016 mysql-community-devel-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user 45150068 Mar 29 2016 mysql-community-embedded-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user 23829224 Mar 29 2016 mysql-community-embedded-compat-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user 124953868 Mar 29 2016 mysql-community-embedded-devel-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user 2237968 Mar 29 2016 mysql-community-libs-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user 2115948 Mar 29 2016 mysql-community-libs-compat-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user 51016520 Mar 29 2016 mysql-community-minimal-debuginfo-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user 158252992 Mar 29 2016 mysql-community-server-5.7.12-1.el7.x86_64.rpm
-rw-r--r-- 1 ec2-user ec2-user 116098332 Mar 29 2016 mysql-community-test-5.7.12-1.el7.x86_64.rpm
安裝及配置
- 命令如下
- 在安裝的程序中mariadb-libs.x86_64會被mysql-community-libs-compat和mysql-community-libs替換,
- 在安裝程序中可能會出現無法替換導致包沖突問題,需要手動卸載mariadb-libs.x84_64,因為cloudera-manager-agent服務依賴mariadb-libs.x86_64包,在卸載mariadb-libs.x84_64的時候需要注意,避免將Cloudera-manager-agent服務卸載,
[ec2-user@ip-186-31-26-102 mysql5.7.12]$ sudo yum -y install mysql-community-*
- 啟動MySQL服務并添加mysqld到自啟動
[ec2-user@ip-186-31-21-45 log]$ sudo service mysqld start
[ec2-user@ip-186-31-21-45 log]$ sudo systemctl enable mysqld
- MySQL的初始密碼
- MsSQL5.7.12版本安裝完成后,已默認設定了初始密碼,需要在/var/log/mysqld.log日志檔案中查找初始密碼,
- 執行mysql_secure_installation腳本初始化MySQL
[ec2-user@ip-186-31-21-45 ~]$ mysql_secure_installation
Securing the MySQL server deployment.
Enter password for user root:
The existing password for the user account root has expired. Please set a new password.
New password:
Re-enter new password:
The 'validate_password' plugin is installed on the server.
The subsequent steps will run with the existing configuration
of the plugin.
Using existing password for root.
Estimated strength of the password: 100
Change the password for root ? ((Press y|Y for Yes, any other key for No) : y
New password:
Re-enter new password:
Estimated strength of the password: 100
Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.
Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.
Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.
Disallow root login remotely? (Press y|Y for Yes, any other key for No) : n
... skipping.
By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.
Remove test database and access to it? (Press y|Y for Yes, any other key for No) : y
- Dropping test database...
Success.
- Removing privileges on test database...
Success.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.
Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.
All done!
[ec2-user@ip-186-31-21-45 ~]$
- MySQL登錄驗證
[ec2-user@ip-186-31-21-45 ~]$ 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.12 MySQL Community Server (GPL)
…
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
驗證建表SQL
- 創建測驗庫
[ec2-user@ip-186-31-21-45 ~]$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.12 MySQL Community Server (GPL)
…
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database test;
Query OK, 1 row affected (0.00 sec)
mysql>
- 匯入sql
[ec2-user@ip-186-31-21-45 ~]$ mysql -uroot -p test < graph_api_test.sql
Enter password:
[ec2-user@ip-186-31-21-45 ~]$
- cloudera manager agent服務依賴mariadb-libs.x86_64或mysql-libs.x86_64包,如果在卸載mariadb-libs.x86_64或mysql-libs.x86_64包時將相應的依賴包卸載,這樣cloudera-manager-agent服務被卸載,就會導致安裝節點的Agent服務例外,
- 在RedHat7作業系統安裝的程序中mariadb-libs.x86_64會被mysql-community-libs-compat和mysql-community-libs替換,
大資料視頻推薦:
CSDN
大資料語音推薦:
企業級大資料技術應用
大資料機器學習案例之推薦系統
自然語言處理
大資料基礎
人工智能:深度學習入門到精通
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/336188.html
標籤:其他
