11
2020
11

Centos7 安装MySQL tar.gz方式 安装后 不能直接mysql运行

  1. tar.gz方式安装完成后可能会出现command not found

  2. #mysql -uroot -p

  3. command not found

  4. 需要配置path

  5. 配置PATH

# vi ~/.bash_profile

在文件最后面加入以下内容,并使用:wq保存

export PATH=$PATH:/usr/local/mysql
  1. 刷新PATH

# source ~/.bash_profile
  1. 登录mysql, 这时mysql没有密码, 当出现Enter password:时直接回车

# mysql -uroot -p
  1. 修改root密码

mysql> use mysql
mysql> update user set password=password('需要设置的密码') where user='root' and host='localhost';
mysql> flush privileges;123
  1. 设置远程登录

mysql>GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '刚才设置的root密码' WITH GRANT OPTION;1

到此所有配置全部完毕. 你可以使用sqlyog或者其他方式登录mysql了


« 上一篇 下一篇 »