linux 常用命令

查看日志  

tail -n 500 -f log.txt 显示文件 log.txt 的后500行内容并在文件内容增加后,自动显示新增的文件内容

打开防火墙配置

执行 vi /etc/sysconfig/iptables

允计 mysql 3306 端口访问

-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

重置mysql密码

1.停止mysql服务器运行,-> service mysql stop

2.进入 mysql 安装目录 /usr/bin/

-> mysqld --skip-grant-tables 

3. 重新打开远程连接,进入mysql 重置密码

mysql> UPDATE mysql.user SET Password=PASSWORD('lianruihong')  WHERE User='root';
mysql> FLUSH PRIVILEGES;

连接mysql的时候发生这个错误:

ERROR 1130: Host [ip] is not allowed to connect to this MySQL server


mysql>update user set host = '%' where user = 'root';

 
原文地址:https://www.cnblogs.com/lianruihong/p/5311034.html