'Unable to set password for the MySQL "root" user' on a Openvz VPS

Solution 1:

I had the exact same issue and it turned out to be a lack of memory issue. Running this script on the host fixed it for me:

#!/bin/bash    
cid=104
vzctl set ${cid} --vmguarpages 1024M --save
vzctl set ${cid} --oomguarpages 1024M --save
vzctl set ${cid} --privvmpages 1024M:1024M --save

Feel free to change 1024 to whatever amount of memory you want your container to have. You will also need to change 104 to the ID of your container.

Solution 2:

Use the command below to change the root password for mysql server

sudo dpkg-reconfigure mysql-server-5.5