Installation package preparation
- In order to ensure the purity of the system before installation, check whether mysql is installed. If it is installed, uninstall mysql and
check: rpm -qa|grep mysql
uninstall: rpm -e --nodeps {installation file found} - Download MySql related installation packages
MySQL-server-5.6.40-1.el6.x86_64 and MySQL-client-5.6.40-1.el6.x86_64
- Install mysql server
rpm -ivh MySQL-server-5.6.24-1.el6.x86_64.rpm - View the generated random password
cat /root/.mysql_secret - View mysql status
service mysql status - start mysql
service mysql start
- Install mysql client
rpm -ivh MySQL-client-5.6.24-1.el6.x86_64.rpm - link mysql
mysql -uroot -pOEXaQuS8IWkG19Xs (random password seen above) - Modify password
mysql>SET PASSWORD=PASSWORD('666666'); - Exit mysql
mysql>exit
As long as the configuration is root user + password, you can log in to the MySQL database on any host.
- Enter mysql
mysql -uroot -p666666 - Show databases
mysql>show databases; - Use mysql database
mysql>use mysql; - Display all tables in the mysql database
mysql>show tables; - Show the structure of the user table
mysql>desc user; - Modify the user table and modify the content of the Host table to%
mysql>update user set host='%' where host='localhost'; - 删除root用户的其他host
mysql>delete from user where Host='hadoop102 ';
mysql>delete from user where Host='127.0.0.1';
mysql>delete from user where Host='::1'; - flush and launch
mysql>flush privileges;
mysql> quit;