1- new mysql
installing mysql by mysql-server
yum install mysql-server
starting mysql
systemctl start mysqld
systemctl status mysqld
changing password for root
cat /var/log/mysqld.log|grep 'temporary password'
2016-12-01T00:22:31.416107Z 1 [Note] A temporary password is generated for root@localhost: mqRfBU_3Xk>r
mysql -u root -p
then use the password mqRfBU_3Xk>r
ALTER USER 'root'@'localhost' IDENTIFIED BY 'password';
given grant to root
GRANT INSERT, SELECT, DELETE, UPDATE ON *.* TO 'root'@'%';
if create a common user, below:
CREATE USER 'common'@'%' IDENTIFIED BY 'password';
2- old mysql
installing mysql locally
wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
md5sum mysql57-community-release-el7-9.noarch.rpm
rpm -ivh mysql57-community-release-el7-9.noarch.rpm
config && make && make install
changing password
[mysqld]
skip-grant-tables
# mysql -u root
mysql> use mysql;
mysql> update mysql.user set authentication_string=password('123') where user='root';
mysql> flush privileges;
mysql> exit