linux环境下元数据库(mysql)的安装

解压mysql安装包

  1. 将mysql的安装文件移至/root/downloads下
  2. 创建文件夹/root/bigdata/mysql
  3. 将安装文件解压至/root/bigdata/mysql

升级并安装依赖包

root@master:~/bigdata/mysql# sudo apt-get upgrade

如果报错

E: 无法获得锁 /var/lib/dpkg/lock-frontend - open (11: 资源暂时不可用)
E: 无法获取 dpkg 前端锁 (/var/lib/dpkg/lock-frontend),是否有其他进程正占用它?
root@master:~/bigdata/mysql# rm /var/cache/apt/archives/lock
root@master:~/bigdata/mysql# rm /var/lib/dpkg/lock
root@master:~/bigdata/mysql# rm /var/lib/dpkg/lock-frontend
root@master:~/bigdata/mysql# apt-get upgrade
E: dpkg 被中断,您必须手工运行 ‘dpkg --configure -a’ 解决此问题。
root@master:~/bigdata/mysql# rm /var/lib/dpkg/updates/*
root@master:~/bigdata/mysql# apt-get update
  1. root@master:~/bigdata/mysql# apt-get upgrade
  2. 无法获取 dpkg 前端锁 (/var/lib/dpkg/lock-frontend),是否有其他进程正占用它? - while19 - 博客园 (cnblogs.com)

 [(23条消息) dpkg 被中断问题解决方法_半遮雨的博客-CSDN博客_dpkg中断](https://blog.csdn.net/qq_14935437/article/details/77199615)

 
root@master:~/bigdata/mysql# apt-get install libaio1

3.按顺序安装deb*****程序包*

root@master:~/bigdata/mysql# dpkg -i mysql-common_8.0.14-1ubuntu18.04_amd64.deb
  1. root@master:~/bigdata/mysql# dpkg -i libmysqlclient21_8.0.14-1ubuntu18.04_amd64.deb
  2. root@master:~/bigdata/mysql# dpkg -i libmysqlclient-dev_8.0.14-1ubuntu18.04_amd64.deb
  3. root@master:~/bigdata/mysql# dpkg -i mysql-community-client-core_8.0.14-1ubuntu18.04_amd64.deb
  4. root@master:~/bigdata/mysql# dpkg -i mysql-community-client_8.0.14-1ubuntu18.04_amd64.deb
  5. root@master:~/bigdata/mysql# apt-get install libaio1 libmecab2 openssh-client
  6. root@master:~/bigdata/mysql# dpkg -i mysql-community-server-core_8.0.14-1ubuntu18.04_amd64.deb
  7. root@master:~/bigdata/mysql# dpkg -i mysql-community-server_8.0.14-1ubuntu18.04_amd64.deb
  8. 此过程会出现图形化界面设置MySQL的密码及验证方式等。

    root@master:~/bigdata/mysql# dpkg -i mysql-server_8.0.14-1ubuntu18.04_amd64.deb

*4.* *检验M**ySQL****是否安装成功*

*5.* *M**ySQL**数据库操作*

(1)登录
mysql -u root –p
(2)创建新用户
create user 'hadming'@'%' identified by '123456';
(3)为用户授权
mysql> grant all on *.* to 'hadming'@'%';
(4)创建数据库
create database hadoopDB;
(5)查看数据库
show databases;
(6)选择数据库
Use hadoopDB
(7)删除数据库
(8)创建表