之前安装的mysql版本为:mysql-5.6.27-linux-glibc2.5-i686.tar,在执行./scripts/mysql_install_db --user=mysql命令时,系统提示“FATAL ERROR: Neither host 'iZuf6d2cbgi4jsxmr4vm7qZ' nor 'localhost' could be looked up with ./bin/resolveip Please configure the 'hostname' command to return a correct hostname. If you want to solve this at a later stage, restart this script with the --fo”,查阅了很多博客,有的说要修改/etc/hosts文件中的ip,有的说是mysql版本不兼容导致,逐一排查,最终将mysql版本替换为“mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz”,得以成功安装,以下安装步骤亲测安装多次。
系统:Centos8.2 64位
Mysql安装包:mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz 下载地址:https://pan.baidu.com/s/1MDaPSabpnQMJ4pfHpA8oQQ 提取码:0s7e
安装步骤:
1、登录linux,将mysql-5.6.43-linux-glibc2.12-x86_64.tar.gzr上传到/usr/local/ 下
2、执行tar zvxf mysql-5.6.43-linux-glibc2.12-x86_64.tar.gz命令,将mysql进行解压 ,然后重命名:mv ./mysql-5.6.43-linux-glibc2.12-x86_64/ ./mysql
3、添加系统mysql组和mysql用户:
groupadd mysql
useradd mysql -g mysql
4、进入到解压完的mysql目录下,修改当前目录拥有者为mysql用户,执行命令:chown -R mysql:mysql ./
5、安装数据库:执行命令:./scripts/mysql_install_db --user=mysql
6、进入到mysql的support-files目录下,执行命令:cp mysql.server /etc/init.d/mysql
7、启动mysql服务:执行命令:service mysql start
8、执行命令:ps -ef | grep mysql,看到mysql服务说明启动成功
9、进入到mysql的bin目录下,设置密码:./mysqladmin -u root password '密码'
10、ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql
11、登录mysql,mysql -h 127.0.0.1 -u root -p
12、对远程访问进行授权(登录mysql后执行):
grant all privileges on *.* to root@"%" identified by '123456' with grant option;