Setting up a basic server, with no password on root
@localhost
account.
# mysqld --user mysql --initialize-insecure
Next you want to set a password for the root account.
- Add or Change Password for existing user (below)
https://dev.mysql.com/doc/refman/5.7/en/account-management-statements.html
CREATE USER IF NOT EXISTS 'user'@'localhost' IDENTIFIED BY 'new_password' PASSWORD EXPIRE never;
CREATE USER IF NOT EXISTS 'user'@'%' IDENTIFIED BY 'new_password' PASSWORD EXPIRE never;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION;
GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION;
GRANT PROXY ON ''@'' TO 'root'@'%' WITH GRANT OPTION;
ALTER USER IF EXISTS 'user'@'localhost' IDENTIFIED BY 'new_password' PASSWORD EXPIRE never;
ALTER USER IF EXISTS 'user'@'%' IDENTIFIED BY 'new_password' PASSWORD EXPIRE never;
select (lower(concat(hex(random_bytes(4)), '-', hex(random_bytes(2)), '-4', substr(hex(random_bytes(2)), -3), '-', hex((ascii(random_bytes(1)) >> 6)+8), substr(hex(random_bytes(2)), -3), '-', hex(random_bytes(6)))));
Source: Generating v4 UUIDs in MySQL