加载中...
MySQL部署(Yum安装)
发表于:2021-12-09 | 分类: 数据库
字数统计: 3k | 阅读时长: 3 mins.分钟 | 阅读量:

Yum源安装 MySQL

安装数据库

  • Redhat6/CentOS6版本

    [root@mysql-server ~]# yum -y install mysql mysql-server
  • Redhat7/CentOS7版本以上

    [root@mysql-server ~]# yum -y install mariadb mariadb-server
  • 启动数据库

    [root@mysql-server ~]# systemctl start mariadb

源码编译安装

登陆数据库

  • 默认MySQL数据库是没有密码
[root@web-server /]# mysql 
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 2
Server version: 5.5.68-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> 

为了数据库的安装我们需要初始化以及设置密码

  • 初始化数据库

    [root@web-server /]# mysql_secure_installation
  • 初始化完成再次登陆 (需要 用户+ 密码 )

    [root@web-server /]# mysql -uroot -p
    Enter password: 
    Welcome to the MariaDB monitor.  Commands end with ; or \g.
    Your MariaDB connection id is 11
    Server version: 5.5.68-MariaDB MariaDB Server
    
    Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
    
    Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    
    MariaDB [(none)]> 

连接数据库方式

上一篇:
PythonValueError
下一篇:
初始监控系统及软件
本文目录
本文目录