Install
1 | yum install mysql mysql-server mysql-libs |
Settings
1 | SHOW VARIABLES LIKE 'character_set_%'; |
1 | set character_set_server=utf8; |
Passwd
mysqladmin
1
mysqladmin -u root password 'psswd'
update
1
2
3
4mysql -u root
mysql> use mysql;
mysql> UPDATE user SET Password = PASSWORD('passwd') WHERE user = 'root';
mysql> FLUSH PRIVILEGES;set
1
2MySQL -u root
mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('passwd');skip
1
2
3
4
5vim /etc/my.cnf
# remove after the job
add `skip-grant-tables`
wq
service mysqld restart
1 | service mysqld stop |
User & Db
1 | create user 'test'@'localhost' identified by '123456'; |
Exception
ERROR 1227 (42000): Access denied; you need (at least one of) …
If sign in mysql in localhost like this:1
mysql -u root -p
no privileges on create user/ create db/ show process …1
2
3
4
5
6show grants for ''@'localhost';
+----------------------------------------------------------------------+
| Grants for @localhost |
+----------------------------------------------------------------------+
| GRANT USAGE ON *.* TO ''@'localhost' IDENTIFIED BY PASSWORD <secret> |
+----------------------------------------------------------------------+
the command should be like this:1
mysql -u root -h 127.0.0.1 -p
Amazon EC2
AWS Linux MySQL Install
ERROR 1227 (42000)
ERROR 1045 (28000)