再次之前做了点东西
数据库 root Aa12345!
设置系统时间 date -s "20170328 10:04:20"
查看硬件时间 hwclock
将时间同步到硬件 clock -w
在这个网站上看到一篇非常靠谱的文档
https://opensourcedbms.com/dbms/installing-mysql-5-7-on-centosredhatfedora/
直接拿来
2. Install MySQL 5.7 Server libraries
Now that you have installed mysql 5.7 yum repo, you can start install mysql server libraries.
yum install -y mysql-community-server
![installing mysql 5.7 yum command](https://opensourcedbms.com/dbms/wp-content/uploads/2016/01/Screen-Shot-2016-01-14-at-10.11.58-PM.png)
installing mysql 5.7 with yum command
3. Start MySQL 5.7 Server and connect to it !
Start MySQL 5.7 service
service mysqld start
And find initial mysql 5.7 root password from log file
grep -i temporary /var/log/mysqld.log
Login into MySQL 5.7 using password you got from temporary password that you searched from above
mysql -uroot -p
Only command MySQL 5.7 is going to let you run once you login with your default password is password command
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('Yourpassword1!');
![MySQL 5.7 default password login](https://opensourcedbms.com/dbms/wp-content/uploads/2016/01/Screen-Shot-2016-01-14-at-10.19.04-PM.png)
MySQL 5.7 default password login
That’s it, you have successfully installed MySQL 5.7 server on CentOS 6/Redhat EL6/Fedora. Open some firewall rules if needed and create users to access your database.
另外加固MySQL安全,这个,仅MySQL5.6适用
mysql_secure_installation
程序可以保证一些重要操作的安全性,如:修改root用户的密码、删除匿名用户等。如果安装是MySQL 5.6,应该保证始终运行该程序:
$ mysql_secure_installation
最后开放权限否则连接不上
GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'Aa12345!' WITH GRANT OPTION;
这个不能忘 flush privileges;
下边还有一种方式,没有试
mysql> -- @'192.168.1.100'可以替换为@‘%’就可任意ip访问,当然我们也可以直接用 UPDATE 更新 root 用户 Host, 但不推荐, SQL如下:
mysql> -- UPDATE user SET Host='192.168.1.100' WHERE User='root' AND Host='localhost' LIMIT 1;
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)