zoukankan      html  css  js  c++  java
  • Centos7.2安装mysql

    1、方法一:安装mariadb

    MariaDB数据库管理系统是MySQL的一个分支,采用GPL授权许可 MariaDB的目的是完全兼容MySQL,包括API和命令行,使之能轻松成为MySQL的代替品。MariaDB由MySQL的创始人Michael Widenius(英语:Michael Widenius)主导开发,他早前将自己创建的公司MySQL AB卖给了SUN,此后,随着SUN被甲骨文收购,MySQL的所有权也落入Oracle的手中。MariaDB名称来自Michael Widenius的女儿Maria的名字。

    安装mariadb,输入安装命令

    [root@localhost home]# yum install mariadb-server mariadb

    mariadb数据库的相关命令是:

       systemctl start mariadb  #启动MariaDB

       systemctl stop mariadb  #停止MariaDB

       systemctl restart mariadb  #重启MariaDB

       systemctl enable mariadb  #设置开机启动

    先启动数据库

      [root@yl-web yl]# systemctl start mariadb

      默认无密码

    [root@localhost lzh]# mysql -u root -p

    Enter password:

    Welcome to the MariaDB monitor.  Commands end with ; or g.

    Your MariaDB connection id is 6

    Server version: 5.5.52-MariaDB MariaDB Server

     

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

     

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

     

     

    MariaDB [(none)]> show databases;

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

    | Database           |

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

    | information_schema |

    | mysql              |

    | performance_schema |

    | test               |

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

    4 rows in set (0.01 sec)

     

     

    2、方法二:官网下载安装mysql-server

    # wget http://dev.mysql.com/get/mysql-community-release-el7-5.noarch.rpm

    # rpm -ivh mysql-community-release-el7-5.noarch.rpm

    # yum install mysql-community-server

    安装成功后重启mysql服务

        # service mysqld restart

    初次安装mysql,root账户没有密码

    [root@localhost lzh]# mysql -u root

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

    Your MySQL connection id is 3

    Server version: 5.6.26 MySQL Community Server (GPL)

     

    Copyright (c) 2000, 2015, 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.01 sec)

    设置密码

    mysql> set password for 'root'@'localhost' =password('password');

    Query OK, 0 rows affected (0.00 sec)

    安装完以后mariadb自动就被替换了,将不再生效。

     

  • 相关阅读:
    20170930-构建之法:现代软件工程-阅读笔记
    结对-四则运算答题器-开发过程
    小米3Android开发学习笔记三
    小米3Android开发学习笔记二
    小米3Android开发学习笔记一
    maya学习之晶格变形
    只说说C++内联函数
    Flash 文件加载方案以及一些问题及解决(1)
    博客内容笔记
    Unity里关于[HideInInspector]23事
  • 原文地址:https://www.cnblogs.com/haozheyu/p/9211887.html
Copyright © 2011-2022 走看看