• Linux mysql8.0.11安装


    准备:检查是否已安装过mysql,若有便删除(linux系统自带的)

        rpm -qa | grep mariadb
        rpm -e nodeps mariadb-libs-5.5.56-2.el7.x86_64

    正文:

    1、cd /mnt

    mkdir tools

    cd tools

    2、下载文件 wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz

    3、解压  tar xzf mysql-8.0.11-linux-glibc2.12-x86_64.tar.gz

    4、 重命名 mv mysql-8.0.11-linux-glibc2.12-x86_64/ mysql8.0.11

    5、创建data目录 

      cd mysql8.0.11/

      mkdir data

    6、创建mysql用户及赋权

      groupadd mysql

      useradd -g mysql mysql

      chown -R mysql:mysql  /mnt/tools/mysql8.0.11/

      chmod -R 777  /mnt/tools/mysql8.0.11/

    7、安装mysql

      ./bin/mysqld --initialize --user=mysql --datadir=/mnt/tools/mysql8.0.11/data --basedir=/mnt/tools/mysql8.0.11

    报错:./bin/mysqld: error while loading shared libraries: libnuma.so.1: cannot open shared object file: No such file or directory

    解决:yum -y install numactl

    记住[Server] A temporary password is generated for root@localhost: ,HyVhD5lhqJB  最后面这个密码,:后面的,包含“,”

    8、启动mysql

      ./support-files/mysql.server start

    报错:

    ./support-files/mysql.server: line 239: my_print_defaults: command not found
    ./support-files/mysql.server: line 259: cd: /usr/local/mysql: No such file or directory
    Starting MySQL ERROR! Couldn't find MySQL server (/usr/local/mysql/bin/mysqld_safe)

    解决:cd support-files/

      vi mysql.server

      将所有的 /usr/local/mysql 替换成 /mnt/tools/mysql8.0.11

      ./mysql.server start   ------启动成功

    9、做启动服务软连接

      ln -s /mnt/tools/mysql8.0.11/support-files/mysql.server /etc/init.d/mysql

      service mysql restart

    10、做mysql服务软连接

      ln -s /mnt/tools/mysql8.0.11/bin/mysql /usr/bin

      mysql -uroot -p

      报错:mysql: error while loading shared libraries: libtinfo.so.5: cannot open shared object file: No such file or directory

      解决:sudo ln -s /usr/lib64/libtinfo.so.6.1 /usr/lib64/libtinfo.so.5

    11、登陆服务修改密码 请务必按此顺序来,不要改动任何字符

      alter user 'root'@'localhost' identified by 'root';

      use mysql

      update user set user.Host='%' where user.User='root';

      flush privileges;

      quit

    12、编辑my.cnf,添加配置文件,配置内容为

      vi /mnt/tools/mysql8.0.11/my.cnf

    [mysqld]
    
    port = 3306
    
    sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

    13.设置开机自启动

      13.1、将服务文件拷贝到init.d下,并重命名为mysql

        cp /mnt/tools/mysql8.0.11/support-files/mysql.server /etc/init.d/mysqld

      13.2、赋予可执行权限

        chmod +x /etc/init.d/mysqld

      13.3、添加服务

        chkconfig --add mysqld

      13.4、显示服务列表

        chkconfig –list

      13.5、重启服务器

        reboot

  • 相关阅读:
    命令[46]
    命令[53]
    命令[48]
    命令[43]
    命令[52]
    命令[55]
    命令[41]
    MYSQL[02]大小写问题
    hdu 1811
    hdu 1829
  • 原文地址:https://www.cnblogs.com/xiufengd/p/14344809.html
Copyright © 2020-2023  润新知