1. Debian static ip setting
It is difficult to move without a network, so you must first set up static IP access to ensure that the network is normal.
- set static IP
vi /etc/network/interfaces
auto ens33 # 开机自启ens33网卡
iface lo inet loopback # 设置回环网卡
allow-hotplug ens33
iface ens33 inet static # 设置静态
address 192.168.17.102
netmask 255.255.255.0
gateway 192.168.17.254
vi /etc/resolv.conf
nameserver 192.168.17.254
nameserver 114.114.114.114
nameserver 8.8.8.8
systemctl restart networking # 重启网络
ping www.baidu.com # 测试网络是否联通,如果通了就可以远程连接了
Notice:
In the default terminal of debian, if the language is set to Chinese, there will be diamond-shaped garbled characters, but this problem can be avoided through Xshell remote access, and the problem of garbled characters will not be solved for the time being.
2. Install VIM
apt update
apt install vim # 用于修改配置文件,要首先安装
3. Change environment variables
In /usr/sbin
the folder there are a number of handy directives such as service
, ifconfig
etc.
vim /etc/profile
export PATH=$PATH:/usr/sbin #文末追加,保存退出
source /etc/profile
4. MariaDB installation
MariaDB is a branch of Mysql, fully compatible with Mysql instructions.
mariadb
Installation instructions:
apt install mariadb-server
The MariaDB configuration file after installation is in /etc/mysql
the folder.
5. Start the data service
# 以下三条指令作用相同
systectl start mariadb
service mariadb start
serivce mysql start
6. Database login
By default, the MariaDB database password is blank, and mysql
you can enter directly:
root@debian:/home/wei# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 30
Server version: 10.5.19-MariaDB-0+deb11u2 Debian 11
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
Notice:
In some cases, the default password of the newly installed MariaDB is not empty. If there is no important data in the database, it is recommended to uninstall and reinstall.
The reason is that after multiple versions of iterations, Mysql has closed many logical loopholes, making it very difficult to change the password.
7. Change root password
use mysql;
alter user root@localhost identified by '123456'; # 将密码设为123456
exit; # 退出系统
mysql -uroot -p # 使用密码登录
8. Set up MariaDB remote access
Grant all database privileges to the root user accessed remotely.
- Change
bind-address
the value to0.0.0.0
vim /etc/mysql/mariadb.conf.d/50-server.cnf # 配置文件
# bind-address = 127.0.0.1
bind-address = 0.0.0.0
Notice
Some online tutorials think that you
bind-address
can comment it out, and the personal test is invalidTherefore, be sure to
bind-address
modify the value of to0.0.0.0
- Grant remote access
# 登录后执行
grant all privileges on *.* to root@'%' identified by '123456' with grant option;
flush privileges;
9. Solve the problem of rhombus garbled characters
During the installation of Debian, if Chinese is selected as the default language of the system, there will be a diamond garbled problem.
Using Xshell remote access can avoid this problem, and it is not necessary to solve this problem if Chinese is displayed normally in the Xshell software.
However, if you have personal needs, you can change the default language to English, as follows:
dpkg-reconfigure locales # dpkg指令存在与/usr/sbin文件夹中
Use the up and down keys and space to select the language:
- choose
en_US.UTF-8
- cancel selection
zh_CN.UTF-8
- reboot
The above is the whole content.