1
我正在准备一个自动shell脚本,但在shell脚本中运行的MySQL命令具有警告:在命令行界面上使用密码可能不安全,并且.sock错误。 请帮我... 我的代码是:在shell脚本中运行的MySQL命令具有错误
user="root"
password="7layer"
db="mysql"
mysql -u "$user" -p"$password" <<EOF
use $db;
mysqld_safe --skip-grant-tables
update user set Password=PASSWORD('7layer') where user='root';
UPDATE mysql.user SET password_expired='N' WHERE User='root';
FLUSH PRIVILEGES;
exit;
EOF
输出为:
Starting MySQL. [ OK ]
Shutting down MySQL.. [ OK ]
Warning: Using a password on the command line interface can be insecure.
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
[[email protected] AutoInstall]#
嗨丹,我想乌尔脚本,但得到PID –
的错误{MySQL服务器PID文件找不到! [FAILED] 正在启动MySQL ..服务器退出时未更新PID文件([FAILED] /mysql/autoinstallapi.ril.com.pid)。 错误2002(HY000):无法通过套接字'/var/lib/mysql/mysql.sock'(2) } –
查看日志。 **确保PID文件存在并可由数据库的uid写入** – DanFromGermany