Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/62.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
尝试设置MySQL根密码会导致错误_Mysql_Wordpress_Debian - Fatal编程技术网

尝试设置MySQL根密码会导致错误

尝试设置MySQL根密码会导致错误,mysql,wordpress,debian,Mysql,Wordpress,Debian,我还是MySQL和Debian的新手,但在过去的几天里我读了很多书 我有一个虚拟机的根帐户,我想用于Wordpress。我读到的一件事是,我应该对MySQL进行密码保护,因为默认情况下,root用户不需要密码 我看到有人这样做: mysql> mysqladmin -u root password mypassword; 但这给了我以下错误: ERROR 1064 (42000): You have an error in your SQL syntax; check the manu

我还是MySQL和Debian的新手,但在过去的几天里我读了很多书

我有一个虚拟机的根帐户,我想用于Wordpress。我读到的一件事是,我应该对MySQL进行密码保护,因为默认情况下,root用户不需要密码

我看到有人这样做:

 mysql> mysqladmin -u root password mypassword;
但这给了我以下错误:

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that     corresponds to your MySQL server version for the right syntax to use near 'mysqladmin -u     root password mypassword' at line 1

您正在mysql中运行该命令,但该命令实际上是直接从终端运行的

mysqladmin-u根密码mypassword


如果您已经在终端中的mysql中,请键入
exit
,然后输入您的
mysqladmin
命令。

您是否尝试直接从shell而不是在mysql中运行该命令?这可能与此有关。我重新启动了ssh连接,并尝试了更多的连接,最后它成功了。不完全确定是什么让它工作的。Scottsands是对的,您不是从mysql>shell运行它,而是直接从终端运行。