简体   繁体   中英

Execute mysql without sudo

I am trying to install wordpress on Odroid C2. However, wordpress could not access mysql.

在此处输入图片说明

So, I tried this.

在此处输入图片说明

If I execute mysql with sudo, it is OK. But, without sudo, I can't.

The OS of C2 is Ubuntu Mate 16.04, so I installed mariaDB instead of mysql.

I followed the guide of mariaDB installation.

How can I use mysql without sudo, and how can my wordpress access the DB.

try this to solve the problem:

Login in your DB

sudo mysql -u root -p

then make these modifications:

MariaDB []>use mysql;
MariaDB [mysql]>update user set plugin='' where User='root';
MariaDB [mysql]>flush privileges;
MariaDB [mysql]>exit

try login again without sudo

This should be an serverfault.com issues. But anyway, go through this checklist

  1. Are you starting mysql with port other than 3306
  2. Check access of mysql client is o+rx , ie ls -la /usr/bin/mysql
  3. Did you grant user access other than "root" in mysqldb/mariadb. Mysql db may prevent you from using root@localhost if it is not running sudo

So if in case no 3, you must create a new user and grant access to it to solve this. ie

GRANT ALL ON <YOUR_WP_DATABASE_NAME>.* TO "wpuser"@"localhost" IDENTIFIED BY "somepassword"; 

Afterwards, try mysql using that user to confirm it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM