• linux上安装mysql


    安装mysql: 

    1.  安装MYSQL
      当前centos7上没有最新版本5.6.21的Mysql yum原,所以不能用如下的方式安装

      yum install MySQL-server
      yum install MySQL-devel

    2. 下载最新的rpm  安装包。 

      MySQL-client-5.6.21-1.el6.x86_64.rpm
      MySQL-server-5.6.21-1.el6.x86_64.rpm 
      MySQL-devel-5.6.21-1.el6.x86_64.rpm

    3. 移除可能冲突的MariaDB
      sudo yum remove MariaDB-server-5.5.53-1.el7.centos.x86_64
      sudo yum remove MariaDB-common-5.5.53-1.el7.centos.x86_64 

    4. 安装:
       sudo rpm -ivh MySQL-server-5.6.21-1.el6.x86_64.rpm
      sudo rpm -ivh MySQL-client-5.6.21-1.el6.x86_64.rpm
      sudo rpm -ivh MySQL-devel-5.6.21-1.el6.x86_64.rpm

    5. 启动mysql 
      sudo service mysql restart

    6. 新增用户 mysqladmin -u root password 123456

    7. 修改本地数据库端口号. vi /etc/my.cnf 加一行port = 3306
    8. 远程登录:
      本地登录数据库  mysql -u root -p123456
      新建远程登录账号
      mysql> CREATE USER 'root'@'你的远程机器IP' IDENTIFIED BY '123456';
      mysql> GRANT ALL PRIVILEGES ON *.* TO 
      'root'@'远程机器IP'
      -> WITH GRANT OPTION; 
      mysql> CREATE USER 'root'@'%' IDENTIFIED BY '123456';
      mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' 
      -> WITH GRANT OPTION;
     
     
    改Root账号的密码方法:

    安装 phpMyadmin来管理数据库:

    如果访问phpMyAdmin服务的时候出现 Forbidden。 可能的原因如下:
    1。没有安装php:  $ yum install php
    2. 默认的只能允许本地访问,如果想远程 修改这个配置文件 vim /etc/httpd/conf/httpd.conf 
    3。还有可能是# vim /etc/httpd/conf/httpd.conf

    Add the following lines here:

    <Directory "/usr/share/phpmyadmin">
        Order allow,deny
        Allow from all
    </Directory>

    最后还是不行

    First edit the file /etc/httpd/conf.d/phpMyAdmin.conf and add the additional line to the directory settings:

    <Directory /usr/share/phpMyAdmin/>
    order deny,allow
    deny from all
    allow from 127.0.0.1
    allow from 192.168.1.0/15
    </Directory>

    If you wanted to allow access to everybody then you could just change it to:

    <Directory /usr/share/phpMyAdmin/>
    order allow,deny
    allow from all
    </Directory>

    解决了上一部的Forbiden错误进入登陆界面:

     #1862 Cannot log in to the MySQL server
    如果有上面的错误,证明数据库密码过期,需要重置。 参照安装数据库的最后一步
     

    新用户名 远程连接:

    enter image description here

     至此其实可以用PHPMyadmin来管理你的数据库了,包括查询等,但是可以装一个下面的客户端,远程连接上去。更好

    本地安装 mysql workbench

    1. 下载mysqlworkbench : http://dev.mysql.com/downloads/workbench/

    2. 下在完成以后 shell 到这个rpm的路径。 执行: sudo yum install mysqlworkbench.rpm 在安装过程中发现错误

    获取 GPG 密钥失败:[Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6"
    解决办法,从rpm上下载这个缺失的文件

    rpm --import http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6

    还有可能出现一些依赖的lib 版本不正确的情况,如

    错误:软件包:mysql-workbench-community-6.3.6-1.el7.x86_64 (/mysql-workbench-community-6.3.6-1.el7.x86_64)
              需要:python-paramiko >= 1.15.1
              已安装: python-paramiko-1.12.4-1.el7.centos.noarch (@extras)
                  python-paramiko = 1.12.4-1.el7.centos

    解决办法: 当前的centos中存在着依赖,他的版本低于需要的。

    yum remove python-paramiko-1.12.4-1.el7.centos.noarch

    网上下载正确的rpm 本地安装一下就行了

    启动mysqlworkbench的时候出现错误

    [ygshen@localhost Software]$ mysql-workbench
    /usr/libexec/mysql-workbench/mysql-workbench-bin: error while loading shared libraries: libtinyxml.so.0: cannot open shared object file: No such file or directory

    原因是缺少依赖包,按理说在rpm install的过程中应该安装了 但是没有需要手动撞一下

    sudo yum install libtiny  (tab以下 )会发现所有的版本

    [ygshen@localhost mysql-workbench]$ sudo yum install tiny
    tinyca2.noarch         tinyxml2-devel.i686    tinyxml-devel.i686
    tinyfugue.x86_64       tinyxml2-devel.x86_64  tinyxml-devel.x86_64
    tinymce.noarch         tinyxml2.i686          tinyxml.i686
    tinyproxy.x86_64       tinyxml2.x86_64      

    安装以下就可以了

    至此安装完成,启动 >shell: mysql-workbench 就启动gui了

  • 相关阅读:
    发布在Xilinx 嵌入式系统中文论坛的旧帖子
    【分享】MPSoC,XEN虚拟机运行裸核应用程序(baremetal, standalone)的中断延迟
    【分享】 在Vivado里关闭R5/GPU,降低Xilinx MPSoC的功耗
    python实现单链表
    Flink 作业问题分析和调优实践
    flink 有状态 udf引发的大坑一
    flink checkpoint 在 window 操作下 全局配置失效的问题
    python实现十大经典排序算法
    Flink on yarn 常见错误
    搭建Spark所遇过的坑
  • 原文地址:https://www.cnblogs.com/ygshen/p/5052976.html
Copyright © 2020-2023  润新知