linux 32 位mysql 安装中的问题 以及修改数据库密码
mysql -u root -p 执行该命令时 报错
-bash: mysql: command not found
解决方法 执行 alias mysql=/usr/local/mysql/bin/mysql 问题解决
mysql -u root -p 执行该命令时 报错
Can't connect to local MySQL server through socket '/tmp/mysql.sock'
原因一:mysql.sock不在 tmp文件下,通过 find / - name mysql.sock 出 该文件的位置
操作 vim /etc/my.cnf 将 socket 目录改为mysql.sock所在的目录
原因二: 当 find / - name mysql.sock 找不到 mysql.sock 文件时,可通过 reboot 重启系统自动生成,
再执行原因一的操作
修改密码 alter user 'root'@'localhost' identified by 'lb1997';
设置远程连接: Grant all privileges on root.* to 'root'@'%';
ERROR 1410 (42000): You are not allowed to create a user with GRANT
解决办法 use mysql ---> update user set host='%' where user='root'; --->Grant all privileges on root.* to 'root'@'%';
执行完后以为万事大吉结果远程连接 还是不行
进入mysql依次执行下面语句
ALTER USER'root'@'localhost' IDENTIFIED BY 'root' PASSWORD EXPIRE NEVER; #
修改加密规则
ALTER USER'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password'; #
更新一下用户的密码
FLUSH PRIVILEGES; #
刷新权限