36 lines
1.0 KiB
SQL
36 lines
1.0 KiB
SQL
-- create cart user with cartpw password and add permissions to cart database. also allow root to connect from any host
|
||
CREATE USER 'cart' @'%' IDENTIFIED BY 'cartpw';
|
||
|
||
GRANT ALL PRIVILEGES ON `cart`.* TO 'cart' @'%';
|
||
|
||
FLUSH PRIVILEGES;
|
||
|
||
GRANT CREATE, ALTER, DROP, REFERENCES ON *.* TO 'cart' @'%';
|
||
|
||
FLUSH PRIVILEGES;
|
||
|
||
GRANT ALL PRIVILEGES ON *.* TO 'root' @'%' WITH GRANT OPTION;
|
||
|
||
FLUSH PRIVILEGES;
|
||
|
||
-- fix Access denied for user 'root'@'192.168.48.4' (using password: YES)
|
||
--To allow the root user to connect from any host, you need to create a new root user with the host set to '%'. Here’s how to do it:
|
||
|
||
CREATE USER 'root' @'%' IDENTIFIED BY '7isg3FCqP1e9aSFw';
|
||
-- Then grant the new user full access to all databases:
|
||
GRANT ALL PRIVILEGES ON *.* TO 'root' @'%' WITH GRANT OPTION;
|
||
|
||
FLUSH PRIVILEGES;
|
||
|
||
-- revoke login from everywhere as ROOT:
|
||
REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'root' @'%';
|
||
|
||
FLUSH PRIVILEGES;
|
||
|
||
--7isg3FCqP1e9aSFw
|
||
|
||
ALTER USER 'cart' @'%' IDENTIFIED BY 'cartpw2024';
|
||
|
||
GRANT ALL PRIVILEGES ON `cart`.* TO 'cart' @'%';
|
||
|
||
FLUSH PRIVILEGES; |