CDH準備(CentOS7安裝MySQL)

#CentOS7安裝MySQLnode

1.安裝前準備mysql

1)下載地址:https://downloads.mysql.com/archives/community/sql

2)卸載系統自帶的mariaDB數據庫

[root@cdhmaster Desktop]# rpm -qa|grep mariadbcentos

mariadb-libs-5.5.44-2.el7.centos.x86_64.net

[root@cdhmaster Desktop]# rpm -e --nodeps mariadb-libs-5.5.44-2.el7.centos.x86_64orm

3)安裝autoconf包server

yum -y install autoconf //此包安裝時會安裝Data:Dumper模塊blog

不安裝此包安裝mysql時會報以下錯:ci

FATAL ERROR: please install the following Perl modules before executing /usr/bin/mysql_install_db:

Data::Dumper

 

2.安裝及配置過程

1)解壓、安裝

[root@cdhmaster mysql]# tar -xvf MySQL-5.6.35-1.el7.x86_64.rpm-bundle.tar

MySQL-server-5.6.35-1.el7.x86_64.rpm

MySQL-client-5.6.35-1.el7.x86_64.rpm

MySQL-shared-compat-5.6.35-1.el7.x86_64.rpm

MySQL-shared-5.6.35-1.el7.x86_64.rpm

MySQL-devel-5.6.35-1.el7.x86_64.rpm

MySQL-test-5.6.35-1.el7.x86_64.rpm

MySQL-embedded-5.6.35-1.el7.x86_64.rpm

[root@cdhmaster mysql]# rpm -ivh MySQL-*.rpmwarning: MySQL-client-5.6.35-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing... ################################# [100%]

Updating / installing...

1:MySQL-devel-5.6.35-1.el7 ################################# [ 14%]

2:MySQL-client-5.6.35-1.el7 ################################# [ 29%]

3:MySQL-test-5.6.35-1.el7 ################################# [ 43%]

4:MySQL-embedded-5.6.35-1.el7 ################################# [ 57%]

5:MySQL-shared-compat-5.6.35-1.el7 ################################# [ 71%]

6:MySQL-shared-5.6.35-1.el7 ################################# [ 86%]

7:MySQL-server-5.6.35-1.el7 ################################# [100%]

2)啓動數據庫

[root@cdhmaster mysql]# /usr/bin/mysql_install_db

Installing MySQL system tables...2017-12-21 14:41:27 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).

...

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

 

/usr/bin/mysqladmin -u root password 'new-password'

/usr/bin/mysqladmin -u root -h cdhmaster password 'new-password'

...

啓動mysql服務

[root@cdhmaster mysql]# service mysql start

Starting MySQL. SUCCESS!

[root@cdhmaster mysql]#

配置root密碼

[root@cdhmaster mysql]# mysqladmin -u root password '你的密碼'

Warning: Using a password on the command line interface can be insecure.

這樣就配置完了,就能夠用mysql -uroot -p登陸了,以下所示:

[root@cdhmaster mysql]# mysql -uroot -p

Enter password:

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

Your MySQL connection id is 4

Server version: 5.6.35 MySQL Community Server (GPL)

 

Copyright (c) 2000, 2016, 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 || test |

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

4 rows in set (0.00 sec)

 

mysql>

能夠經過如下命令設置mysql服務開機自啓動:

chkconfig mysql on

遇到的問題解決連接:http://blog.csdn.net/vurtne_ye/article/details/26514499

http://blog.csdn.net/rogerzhanglijie/article/details/9182125

相關文章
相關標籤/搜索