Forma 1
sudo grep 'temporary password' /var/log/mysqld.log
2016-11-29T17:41:59.782183Z 1 [Note] A temporary password is generated for root@localhost: *ZxXXOm>,y:y3!Z
copie a senha temporaria
mysql -u root -p
Enter password: <<infomre a senha temporaria>>
ALTER USER 'root'@'localhost' IDENTIFIED BY 'nova senha';
flush privileges;
turn off password validation
- Login to the mysql server as root
mysql -h localhost -u root -p
- Run the following sql command:
uninstall plugin validate_password;
Forma 2
Login in mysql using:
$ mysql -u root -pFirst create a database using:
mysql> create database dbname;
Query OK, 1 row affected (0.00 sec)
Then in mysql shell create new user using:
mysql> create user 'username'@'localhost' IDENTiFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on dbname.* to 'username'@'localhost' with grant option;
Query OK, 0 rows affected (0.00 sec)
Or you can use ‘%’ wildcard if you want to connect mysql from any host:
mysql> create user 'username'@'%' IDENTiFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)
mysql> grant all privileges on dbname.* to 'username'@'%' with grant option;
Query OK, 0 rows affected (0.00 sec)
fonte: http://abhinavkush.wordpress.com/2011/02/21/create-new-mysql-user-with-grant-option/
Nenhum comentário:
Postar um comentário