• linux 安装MYSQL


    转自:http://www.cnblogs.com/bookwed/p/5896619.html

    1、下载

        下载地址:http://dev.mysql.com/downloads/mysql/5.6.html#downloads

        下载版本:我这里选择的5.6.33,通用版,linux下64位

        也可以直接复制64位的下载地址,通过命令下载:wget http://dev.mysql.com/get/Downloads/MySQL-5.6/mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz

    2、解压

    1
    2
    3
    4
    #解压
    tar -zxvf mysql-5.6.33-linux-glibc2.5-x86_64.tar.gz
    #复制解压后的mysql目录
    cp -r mysql-5.6.33-linux-glibc2.5-x86_64 /usr/local/mysql

    3、添加用户组和用户

    1
    2
    3
    4
    #添加用户组
    groupadd mysql
    #添加用户mysql 到用户组mysql
    useradd -g mysql mysql

    4、安装

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    cd /usr/local/mysql/<br>mkdir ./data/mysql
    chown -R mysql:mysql ./
    ./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data/mysql
    cp support-files/mysql.server /etc/init.d/mysqld
    chmod 755 /etc/init.d/mysqld
    cp support-files/my-default.cnf /etc/my.cnf
     
    #修改启动脚本
    vi /etc/init.d/mysqld
     
    #修改项:
    basedir=/usr/local/mysql/
    datadir=/usr/local/mysql/data/mysql
     
    #启动服务
    service mysqld start
     
    #测试连接
    ./mysql/bin/mysql -uroot
     
    #加入环境变量,编辑 /etc/profile,这样可以在任何地方用mysql命令了
    export PATH=$PATH:/usr/local/mysql//bin<br>source /etc/profile
     
     
    #启动mysql
    service mysqld start
    #关闭mysql
    service mysqld stop
    #查看运行状态
    service mysqld status

    5、错误

      5.1 sqlyog连接时,报1130错误,是由于没有给远程连接的用户权限问题

        解决1:更改 ‘mysql’数据库‘user’表‘host’项,从‘localhost’改成‘%’。

    use mysql;
    select 'host' from user where user='root'; 
    update user set host = '%' where user ='root';
    flush privileges; 

        解决2:直接授权

          GRANT ALL PRIVILEGES ON *.* TO ‘root’@'%’ IDENTIFIED BY ‘youpassword’ WITH GRANT OPTION;

      5.2 安装时的一些错误

        -bash: ./scripts/mysql_install_db: /usr/bin/perl: bad interpreter: 没有那个文件或目录
        解决: yum -y install perl perl-devel

        Installing MySQL system tables..../bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
        解决:yum -y install libaio-devel

    6、其他

      6.1 配置环境变量

        vi + /etc/profile

        export PATH=....:/usr/local/mysql/bin

  • 相关阅读:
    自己第一个github开源的感受
    直播时代--IOS直播客户端SDK,美颜直播【开源】
    OpenCL / OpenGL / OpenAL
    FFmpeg 라이브러리 코덱과 영상 변환을 중심으로
    nginx + http2.0 解决浏览器跨域和同源限制问题
    软件编译系统构建
    SRS支持rtmp/srt/gb28181/webrtc上行推流和rtmp/http-flv/hls/dash/gb28181/webrtc下行拉流
    SIP UA/UAC/UAS/GB28181-Server/GB28181-Client 五合一
    SUPL(安全用户面定位)
    RTMP低延时配置
  • 原文地址:https://www.cnblogs.com/yinkh/p/6351439.html
Copyright © 2020-2023  润新知