办事器长途连贯mysql时涌现的题目综合
一、 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`;
六、虚拟主机
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
七、设定开机启动:默许图形化界面切换为 下令行模式
修改为下令模式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时涌现的题目综合的细致内容,更多请关注 百分百源码网 其它相干文章!