Install mysql on inux

1. to verify whether the installation mysql

If there is no proof output is not installed! Excuting an order:
rpm -qa | grep mysql

2. The first download the mysql repo source

This thing called mysql source, is literally mysql source, execute the command:
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm

3. Install mysql rpm package, execute the command:

sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm

4. Install mysql, execute the command:

sudo yum install mysql-server

We can see more than 130 M or big
input y to confirm and start downloading! And finally to 100%, have to rely on downloading, press Enter y to continue downloading

can be considered ojbk, and continue!

5. Login and then reset the password, execute:

mysql -u root

The reason is that access issues / var / lib / mysql's. The following commands to / var / lib / mysql owner instead of the current user

6. Run empowerment, restart mysql:

sudo chown -R openscanner:openscanner /var/lib/mysql
service mysqld restart

7. reset the password again:

mysql -u root
use mysql;
update user set password=password('123456') where user='root';
exit;

8. Test link:


The reason: mysql server root by default only allow localhost 127.0.0.1 is connected
to log mysql: mysql -u root -p
Enter password: you can directly enter the password is entered will complain as follows

9. Continue to directly enter

mysql -u root -p
Enter and execute the following command:

use mysql; 选择mysql库
select host from user where user='root';//查看mysql库中的user表的host值(即可进行连接访问的主机/IP名称)
update user set host = '%' where user ='root'; //修改host值(以通配符%的内容增加主机/IP地址),当然也可以直接增加IP地址 %通配符表示所有ip都允许通过root账号链接
flush privileges; //刷新MySQL的系统权限相关表
select host from user where user='root'; //再重新查看user表时,有修改。。

10. At this time with the client and then reconnect it to try: ok friends


By the way, the new data comes three libraries open. Do not hand cheap delete Ha, you create an execution list are, and there's a table-related, or you commit rollback how it knows of
my hand cheap deleted through locally-installed mysql learning before, and later found that the data and then execute on the error when the sql operation, find ways to solve the last reloading before
and did not know either to study or not to move:

Guess you like

Origin www.cnblogs.com/itiaotiao/p/12632469.html