Intranet centos 7 install mysql and record of possible problems

Intranet centos 7 install mysql and record of possible problems

To install mysql on the public network centos 7 see:
Server Deployment-"MySQL"-Rookie Xiaohui
Due to internal network reasons, individual commands on the public network have problems, and can only be installed in the form of unzip packages.
Main process reference:
CentOS 7.2 intranet environment to build MySQL 5.7.24

Possible problems:

1. When using the msqld command: -bash: mysqld: command not found.

The problem occurs because of the environment variable problem. The solution is to configure the environment variable. After the configuration is complete, use the mysqld command again

vi /etc/profile
#末尾添加
export PATH=$PATH:/usr/local/mysql/bin
#刷新环境变量
source /etc/profile

二、执行mysqld --initialize --user=mysql报错:Can’t change to run as user ‘mysql’ Please check that the user exists

solve:

#创建mysql用户
useradd mysql
#mysql目录改为mysql读写权限
chown -R mysql:mysql /var/lib/mysql
chown -R mysql:mysql /usr/local/mysql

Solution source

3. When using navicate to connect to mysql: ERROR 1062 (23000): Duplicate entry'%-root' for key'PRIMARY'

  • Reason: firewall problem that is often talked about, port 3306 is not open
  • solve:
#开放防火墙3306端口
firewall-cmd --zone=public --add-port=3306/tcp --permanent
#重启防火墙
systemctl restart firewalld.service

Guess you like

Origin blog.csdn.net/qq_39231769/article/details/108513368