hive 元数据 mysql-1

[root@name01 hdfs]# jps
2913 SecondaryNameNode
3538 RunJar
3061 ResourceManager
2742 DataNode
2650 NameNode
3772 Jps
3151 NodeManager
[root@name01 hdfs]# mysql -u root -p
bash: mysql: command not found
[root@name01 hdfs]# apt-get install mysql-server
bash: apt-get: command not found
[root@name01 hdfs]# yum install mysql-server
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirrors.neusoft.edu.cn
 * extras: mirrors.neusoft.edu.cn
 * updates: mirrors.neusoft.edu.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.i686 0:5.1.73-7.el6 will be installed
--> Processing Dependency: mysql = 5.1.73-7.el6 for package: mysql-server-5.1.73-7.el6.i686
--> Processing Dependency: perl-DBI for package: mysql-server-5.1.73-7.el6.i686
--> Processing Dependency: perl-DBD-MySQL for package: mysql-server-5.1.73-7.el6.i686
--> Processing Dependency: perl(DBI) for package: mysql-server-5.1.73-7.el6.i686
--> Processing Dependency: libssl.so.10(libssl.so.10) for package: mysql-server-5.1.73-7.el6.i686
--> Processing Dependency: libcrypto.so.10(libcrypto.so.10) for package: mysql-server-5.1.73-7.el6.i686
--> Running transaction check
---> Package mysql.i686 0:5.1.73-7.el6 will be installed
--> Processing Dependency: mysql-libs = 5.1.73-7.el6 for package: mysql-5.1.73-7.el6.i686
---> Package openssl.i686 0:1.0.0-27.el6 will be updated
---> Package openssl.i686 0:1.0.1e-48.el6_8.1 will be an update
---> Package perl-DBD-MySQL.i686 0:4.013-3.el6 will be installed
---> Package perl-DBI.i686 0:1.609-4.el6 will be installed
--> Running transaction check
---> Package mysql-libs.i686 0:5.1.66-2.el6_3 will be updated
---> Package mysql-libs.i686 0:5.1.73-7.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package              Arch       Version                    Repository     Size
================================================================================
Installing:
 mysql-server         i686       5.1.73-7.el6               base          8.8 M
Installing for dependencies:
 mysql                i686       5.1.73-7.el6               base          904 k
 perl-DBD-MySQL       i686       4.013-3.el6                base          134 k
 perl-DBI             i686       1.609-4.el6                base          705 k
Updating for dependencies:
 mysql-libs           i686       5.1.73-7.el6               base          1.2 M
 openssl              i686       1.0.1e-48.el6_8.1          updates       1.5 M

Transaction Summary
================================================================================
Install       4 Package(s)
Upgrade       2 Package(s)

Total download size: 13 M
Is this ok [y/N]: y
Downloading Packages:
(1/6): mysql-5.1.73-7.el6.i686.rpm                       | 904 kB     00:04     
(2/6): mysql-libs-5.1.73-7.el6.i686.rpm                  | 1.2 MB     00:04     
(3/6): mysql-server-5.1.73-7.el6.i686.rpm                | 8.8 MB     00:33     
(4/6): openssl-1.0.1e-48.el6_8.1.i686.rpm                | 1.5 MB     00:07     
(5/6): perl-DBD-MySQL-4.013-3.el6.i686.rpm               | 134 kB     00:00     
(6/6): perl-DBI-1.609-4.el6.i686.rpm                     | 705 kB     00:02     
--------------------------------------------------------------------------------
Total                                           257 kB/s |  13 MB     00:52     
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Importing GPG key 0xC105B9DE:
 Userid : CentOS-6 Key (CentOS 6 Official Signing Key) <centos-6-key@centos.org>
 Package: centos-release-6-4.el6.centos.10.i686 (@anaconda-CentOS-201303020136.i386/6.4)
 From   : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Is this ok [y/N]: y
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : openssl-1.0.1e-48.el6_8.1.i686                               1/8 
  Updating   : mysql-libs-5.1.73-7.el6.i686                                 2/8 
  Installing : perl-DBI-1.609-4.el6.i686                                    3/8 
  Installing : perl-DBD-MySQL-4.013-3.el6.i686                              4/8 
  Installing : mysql-5.1.73-7.el6.i686                                      5/8 
  Installing : mysql-server-5.1.73-7.el6.i686                               6/8 
  Cleanup    : mysql-libs-5.1.66-2.el6_3.i686                               7/8 
  Cleanup    : openssl-1.0.0-27.el6.i686                                    8/8 
  Verifying  : perl-DBD-MySQL-4.013-3.el6.i686                              1/8 
  Verifying  : mysql-server-5.1.73-7.el6.i686                               2/8 
  Verifying  : perl-DBI-1.609-4.el6.i686                                    3/8 
  Verifying  : mysql-libs-5.1.73-7.el6.i686                                 4/8 
  Verifying  : mysql-5.1.73-7.el6.i686                                      5/8 
  Verifying  : openssl-1.0.1e-48.el6_8.1.i686                               6/8 
  Verifying  : openssl-1.0.0-27.el6.i686                                    7/8 
  Verifying  : mysql-libs-5.1.66-2.el6_3.i686                               8/8 

Installed:
  mysql-server.i686 0:5.1.73-7.el6                                              

Dependency Installed:
  mysql.i686 0:5.1.73-7.el6           perl-DBD-MySQL.i686 0:4.013-3.el6        
  perl-DBI.i686 0:1.609-4.el6        

Dependency Updated:
  mysql-libs.i686 0:5.1.73-7.el6        openssl.i686 0:1.0.1e-48.el6_8.1       

Complete!
[root@name01 hdfs]# service mysqld status
mysqld is stopped
[root@name01 hdfs]# service mysqld start
Initializing MySQL database:  Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

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 name01 password 'new-password'

Alternatively you can run:
/usr/bin/mysql_secure_installation

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

                                                           [  OK  ]
Starting mysqld:                                           [  OK  ]
[root@name01 hdfs]# service mysqld status
mysqld (pid  4094) is running...
[root@name01 hdfs]# /usr/bin/mysql_secure_installation




NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


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? [Y/n] n
 ... skipping.

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? [Y/n] 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? [Y/n] n
 ... skipping.

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...



All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!


[root@name01 hdfs]# 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.1.73 Source distribution

Copyright (c) 2000, 2013, 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 tables;
ERROR 1046 (3D000): No database selected
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)

mysql> create database hivedb;
Query OK, 1 row affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| hivedb             |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> create user 'hive' identified by '1234';
Query OK, 0 rows affected (0.00 sec)

mysql> create user 'hiveuser' identified by 'hiveuser';
Query OK, 0 rows affected (0.00 sec)

mysql> create user 'hive' identified by 'hive';
ERROR 1396 (HY000): Operation CREATE USER failed for 'hive'@'%'
mysql> drop user hiveuser;
Query OK, 0 rows affected (0.00 sec)

mysql> create user 'hiveuser' identified by 'hivepwd';
Query OK, 0 rows affected (0.00 sec)

mysql> create user 'hiveuser' identified by 'hivepwd';
ERROR 1396 (HY000): Operation CREATE USER failed for 'hiveuser'@'%'
mysql> no create  the same  user;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'no create  the same  user' at line 1
mysql> show user;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'user' at line 1
mysql> id
    -> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'id' at line 1
mysql> select user();
+----------------+
| user()         |
+----------------+
| root@localhost |
+----------------+
1 row in set (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| hivedb             |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> drop database hivedb;
Query OK, 0 rows affected (0.00 sec)

mysql> mysql -u hiveuser -p
    -> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql -u hiveuser -p' at line 1
mysql> exit;
Bye
[root@name01 hdfs]# mysql -u hiveuser -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'hiveuser'@'localhost' (using password: YES)
[root@name01 hdfs]# mysql -u hiveuser -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'hiveuser'@'localhost' (using password: YES)
[root@name01 hdfs]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, 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> grant all privileges on hivedb.* to hiveuser@"localhost" identified by "hive" with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to hiveuser@"localhost" identified by "hive" with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> grant all privileges on *.* to hiveuser@"localhost" identified by "hivepwd" with grant option;
Query OK, 0 rows affected (0.00 sec)

mysql> exit;
Bye
[root@name01 hdfs]# mysql -u hiveuser -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.1.73 Source distribution

Copyright (c) 2000, 2013, 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              |
| test               |
+--------------------+
3 rows in set (0.00 sec)

mysql> show tables;
ERROR 1046 (3D000): No database selected
mysql> create database hivedb;
ERROR 1007 (HY000): Can't create database 'hivedb'; database exists
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| hivedb             |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> select user();
+--------------------+
| user()             |
+--------------------+
| hiveuser@localhost |
+--------------------+
1 row in set (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| hivedb             |
| mysql              |
| test               |
+--------------------+
4 rows in set (0.00 sec)

mysql> !pwd
    -> ;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '!pwd' at line 1
mysql> drop database hivedb;
Query OK, 20 rows affected (0.14 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| test               |
+--------------------+
3 rows in set (0.00 sec)

mysql> select user();
+--------------------+
| user()             |
+--------------------+
| hiveuser@localhost |
+--------------------+
1 row in set (0.00 sec)

mysql> 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

5icode.top

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值