How to change root Password? #322

Closed
opened 2026-02-04 18:28:55 +03:00 by OVERLORD · 5 comments
Owner

Originally created by @eligiable on GitHub (Apr 26, 2017).

For Feature Requests

Desired Feature:

For Bug Reports

  • BookStack Version: latest
  • PHP Version: 7
  • MySQL Version: 5.7
Expected Behavior
Actual Behavior

Everything works fine using the Installation Script for Ubuntu 16.04, but not able to change root password, all the practices for MySQL not working.

https://help.ubuntu.com/community/MysqlPasswordReset

Thanx in advance.

Originally created by @eligiable on GitHub (Apr 26, 2017). ### For Feature Requests Desired Feature: ### For Bug Reports * BookStack Version: latest * PHP Version: 7 * MySQL Version: 5.7 ##### Expected Behavior ##### Actual Behavior Everything works fine using the Installation Script for Ubuntu 16.04, but not able to change root password, all the practices for MySQL not working. https://help.ubuntu.com/community/MysqlPasswordReset Thanx in advance.
Author
Owner

@ssddanbrown commented on GitHub (Apr 26, 2017):

Hi @eligiable,
I don't think a password is set by default when running that script. In recent versions of MySQL & Ubuntu the root MySQL account has required root/sudo permissions.

What happens when you run the below command, Do you get access to MySQL?

sudo mysql -u root
@ssddanbrown commented on GitHub (Apr 26, 2017): Hi @eligiable, I don't think a password is set by default when running that script. In recent versions of MySQL & Ubuntu the root MySQL account has required root/sudo permissions. What happens when you run the below command, Do you get access to MySQL? ``` sudo mysql -u root ```
Author
Owner

@eligiable commented on GitHub (Apr 27, 2017):

Hi @ssddanbrown
I've tried everything and still getting the error:

Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

I've edited the Installation Script for Ubuntu, to give full rights to the user bookstack to assign a password for root, but no luck.

Tried to change the MySQL sock, but still not working.
Tried also to change the script from NONInteractive to Interactive mode, but the options for MySQL Prompt does not appear.

Is there a way on the Installation Script to assign the MySQL root password on the fly, to avoid this.

Thanx in Advance

@eligiable commented on GitHub (Apr 27, 2017): Hi @ssddanbrown I've tried everything and still getting the error: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' I've edited the Installation Script for Ubuntu, to give full rights to the user bookstack to assign a password for root, but no luck. Tried to change the MySQL sock, but still not working. Tried also to change the script from NONInteractive to Interactive mode, but the options for MySQL Prompt does not appear. Is there a way on the Installation Script to assign the MySQL root password on the fly, to avoid this. Thanx in Advance
Author
Owner

@ssddanbrown commented on GitHub (Apr 28, 2017):

@eligiable Unfortunately no, There is currently not a way to assign the MySQL root password.

I've just double checked in a fresh VM and no password is set during the installations using the script. sudo mysql -u root worked fine after initial run.

Maybe the best option at this stage would be to export your data then fully purge+reinstall mysql-server?

@ssddanbrown commented on GitHub (Apr 28, 2017): @eligiable Unfortunately no, There is currently not a way to assign the MySQL root password. I've just double checked in a fresh VM and no password is set during the installations using the script. `sudo mysql -u root` worked fine after initial run. Maybe the best option at this stage would be to export your data then fully purge+reinstall mysql-server?
Author
Owner

@eligiable commented on GitHub (Apr 30, 2017):

Hi @ssddanbrown
Thanx it worked ...

sudo mysql -u root
SELECT user, host FROM mysql.user;
DROP USER 'root'@'localhost';
CREATE USER 'root'@'%' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON . TO 'root'@'%';
FLUSH PRIVILEGES;

If you install 5.7 and don’t provide a password to the root user, it will use the auth_socket plugin. That plugin doesn’t care and doesn’t need a password. It just checks if the user is connecting using a UNIX socket and then compares the username.

ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Password';

@eligiable commented on GitHub (Apr 30, 2017): Hi @ssddanbrown Thanx it worked ... sudo mysql -u root SELECT user, host FROM mysql.user; DROP USER 'root'@'localhost'; CREATE USER 'root'@'%' IDENTIFIED BY 'password'; GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; FLUSH PRIVILEGES; If you install 5.7 and don’t provide a password to the root user, it will use the auth_socket plugin. That plugin doesn’t care and doesn’t need a password. It just checks if the user is connecting using a UNIX socket and then compares the username. ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'Password';
Author
Owner

@ssddanbrown commented on GitHub (Apr 30, 2017):

@eligiable Yayy, Glad to hear you got access again!

@ssddanbrown commented on GitHub (Apr 30, 2017): @eligiable Yayy, Glad to hear you got access again!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/BookStack#322