远程连接
Mac系统,终端terminal
ssh 服务器用户名@ip (如:ssh root@xxx.xxx.xxx.xxx)
输入密码
python3安装
开发依赖:
# yum -y groupinstall development
# yum -y install zlib-devel
安装python:
[root@VM_58_11_centos ~]# wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz 获取安装包
[root@VM_58_11_centos ~]# tar -zxf Python-3.6.1.tgz 解压缩
[root@VM_58_11_centos ~]# cd Python-3.6.1 定位到文件夹
#查看安装包文件
[root@VM_58_11_centos Python-3.6.1]# ls
[root@localhost Python-3.6.1]# ./configure 添加配置
[root@localhost Python-3.6.1]# make 编译源码
[root@localhost Python-3.6.1]# make install 执行安装
xampp
xampp安装
1 | # wget http://sourceforge.net/projects/xampp/files/XAMPP%20Linux/5.6.14/xampp-linux-x64-5.6.14-0-installer.run xampp下载 |
远程连接mysql报错
2013 - Lost connection to MySQL server at ‘reading initial communication packet’, system error: 0
未解决
MySQL
安装
[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
[root@localhost src]# rpm -ivh mysql57-community-release-el7-8.noarch.rpm
[root@localhost src]# yum -y install mysql-server
配置my.cnf
vim /etc/my.cnf
1 | [mysqld] |
启动mysql服务
service mysqld restart
重置密码
获取随机产生的密码
# grep "password" /var/log/mysqld.log
1 | [root@VM_32_16_centos ~]# grep "password" /var/log/mysqld.log |
使用该密码进入数据库
[root@VM_32_16_centos ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.7.24
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
重置密码前无法操作数据库
mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
修改密码
密码需为包含大小写,数字及符号的字符串
alter user ‘root’@’localhost’ identified by ‘包含大小写,数字及符号的字符串’;
添加新用户
grant all on *.* to 'newroot'@'%' identified by '密码' with grant option;
@’%’可以任意IP登录,@IP地址则限制只能让指定IP登录
刷新权限
flush privileges;
远程连接
2003 - Can't connect to MySQL server on 'XXX.xxx.xxx.xxx'
参考Remote Access MySQL connection error:https://stackoverflow.com/questions/29370829/remote-access-mysql-connection-error?spm=a2c4e.11153940.blogcont614613.12.57664a72R9A5pg
检查tcp
[root@VM_32_16_centos ~]# nc -l -p 3306
Ncat: bind to :::3306: Address already in use. QUITTING.
如果没有安装nc,先安装
# yum install nc
检查端口
[root@VM_32_16_centos ~]# nc ip地址 3306
Ncat: Connection timed out.
If this is not working, this is not a mysql server configuration issue but a network issue, and you must check your router firewall rules.
Otherwise, your problem comes from mysql server settings. Check your mysql configuration file for bind-address, and remove them to make mysqld accept clients from any IP address.
防火墙问题。
解决方法(已解决)
通过使用SSH通过连接。端口22,用户名密码为使用ssh登陆服务器时的用户名密码,常规里ip为localhost,端口3306,用户名密码为mysql的用户名密码。