一、 centos下处理长途衔接不上的题目。
1、检察centos 下防火墙是不是封闭:
经由过程历程: ps -aux |grep firewalld
ps -ef |grep firewalld
经由过程效劳:pgrep firewalld
systemctl status firewalld
封闭防火墙: systemctl stop firewalld
service iptables off
2、长途衔接走的是sshd 效劳,是ssh协定,端口号是 22.
检察 sshd 效劳是不是已开启:
经由过程历程: ps -aux |grep sshd
经由过程效劳:pgrep sshd
开启效劳: systemctl start sshd
把sshd 效劳到场到开机启动:chkconfig sshd on
3、检察IP地点。
ifconfig
在windows下,cmd窗口内里,ping一下上面的ip地点,看是不是能够ping通。
报错 怎么办?
数据库衔接不上?涌现下面的题目?
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock ???
怎么办?
先检察 /etc/rc.d/init.d/mysqld status 看看mysql是不是已启动.
如果是权限题目,则先转变权限 #chown -R mysql:mysql /var/lib/mysql
[root@localhost ~]# /etc/init.d/mysqld start
启动 MySQL: [ 肯定 ]
[root@localhost ~]# mysql -uroot -p
10038?(长途没有受权)
10060?(到场安全组)
相干教程:mysql视频教程
二、数据库操纵:
1、开启mysql。
systemctl start mariadb
2、首先是设置暗码,会提醒先输入暗码
mysql_secure_installation
3、建立普通用户:
create user zhangsan@localhost identified by 'root';
mysql -u root -p
update user set host='%' where host='127.0.0.1';
flush privileges;
4、受权root用户长途登录:
grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
flush privileges;
update user set user='root' where host='localhost';
相干教程:mysql视频教程
三、mysql长途衔接不上的处理要领:
1、防火墙:
设置防火墙,开机不启动:
chkconfig firewalld off
封闭防火墙:
systemctl disable firewalld
systemctl stop firewalld
或许杀死 防火墙的历程。
检察防火墙的历程存在么:pgrep firewalld,
然后 杀死历程: kill pid
或许 pkill firewalld
2、没有长途权限
授与长途登录权限
grant all privileges on *.* to 'root'@'%' identified by '123456';
flush privileges;
3、开启sshd效劳: systemctl start sshd
把sshd 效劳到场到开机启动:chkconfig sshd on
四、在windows 接见Linux下的项目
开启Linux中 Apache效劳,即httpd效劳systemctl start httpd或许: service httpd start
Windows下面浏览器接见Linux下的项目:浏览器地点栏输入IP地点即可:(可经由过程ifconfig 检察本身的IP地点)比方 192.168.0.1
五、Windows下设置假造域名要领:
设置当地hosts 文件。
位置:C:\Windows\System32\drivers\etc\hosts
增加 对应假造主机名即可。
192.168.226.129 linux.cc
mysql的CRUD;
增加:
INSERT INTO `user` (`id`, `username`, `passwd`, `sex`) VALUES ('1', 'zhangsan', '12345', '')
更新:
UPDATE `user` SET `sex`='女' WHERE (`id`='2')
删除:
DELETE FROM `user` WHERE (`id`='2')
查询:
SELECT * FROM `user`;
六、假造主机
<VirtualHost *:80>
ServerAdmin webmaster@dummy-host.example.com
DocumentRoot /www/docs/dummy-host.example.com
ServerName dummy-host.example.com
ErrorLog logs/dummy-host.example.com-error_log
CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>
七、设置开机启动:默许图形化界面切换为 敕令行形式
修改成敕令形式multi-user.target:
[root@localhost ~]# systemctl set-default multi-user.target
rm '/etc/systemd/system/default.target'
ln -s '/usr/lib/systemd/system/multi-user.target' '/etc/systemd/system/default.target'
[root@localhost ~]# systemctl get-default
获得:multi-user.target:到达结果。
在切换为:图形化形式:systemctl set-default graphical.target
八、设置文件申明
A: httpd.conf Apache的主设置文件。
B: php.ini PHP的主设置文件
D: httpd-vhost.conf 设置假造主机的时刻,变动的文件
E:my.cnf linux下mysql的主设置文件
注重: Windows下面mysql的主设置文件 my.ini
相干教程:PHP视频教程
以上就是效劳器长途衔接mysql时涌现的题目综合的细致内容,更多请关注ki4网别的相干文章!