同ubuntu一样,深度系统也是使用apt-get安装软件,配置源的方式同Ubuntu配置源与安装软件,更换deepin的源就行
# 使用CTRL + ALT + T打开终端
# 切换到apt目录
qfmx520@qfmx520-PC:~$ cd /etc/apt
# 找到资源配置文件sources.list,可以使用cp命令先备份再修改
qfmx520@qfmx520-PC:/etc/apt$ ls -l
总用量 52
drwxr-xr-x 2 root root 4096 5月 16 06:15 apt.conf.d
-rw-r--r-- 1 root root 1 5月 16 06:15 preferences
drwxr-xr-x 2 root root 4096 5月 16 06:15 preferences.d
-rw-r--r-- 1 root root 153 5月 16 19:32 sources.list
-rw-r--r-- 1 root root 94 5月 16 06:19 sources.list~
-rw-r--r-- 1 root root 1064 5月 16 19:20 sources.list2.temp
drwxr-xr-x 2 root root 4096 5月 16 20:02 sources.list.d
-rw-r--r-- 1 root root 184 5月 16 06:26 sources.list.temp
-rw-r--r-- 1 root root 6822 5月 16 18:35 trusted.gpg
-rw-r--r-- 1 root root 4575 5月 16 06:15 trusted.gpg~
drwxr-xr-x 2 root root 4096 5月 16 20:02 trusted.gpg.d
# 使用vim编辑器编辑sources.list编辑配置文件(deepin自带vim)
qfmx520@qfmx520-PC:/etc/apt$ sudo vim sources.list
# 更改为以下内容(中科大源,你也可以更换为清华源自己百度更换即可)
deb [by-hash=force] http://mirrors.ustc.edu.cn/deepin panda main contrib non-free
#deb-src http://mirrors.ustc.edu.cn/deepin panda main contrib non-free
# 重要的一步,更新apt配置文件
sudo apt-get update
apt-get常用命令
dpkg -l // 列出已安装的所有软件包
apt-cache search PackageName // 搜索软件包
apt-cache show PackageName // 获取软件包的相关信息, 如说明、大小、版本等
apt-cache depends PackageName // 查看该软件包需要哪些依赖包
apt-cache rdepends PackageName // 查看该软件包被哪些包依赖
apt-get check // 检查是否有损坏的依赖
apt-get install PackageName // 普通安装
apt-get install PackageName=VersionName // 安装指定包的指定版本
apt-get --reinstall install PackageName // 重新安装
apt-get build-dep PackageName // 安装源码包所需要的编译环境
apt-get -f install // 修复依赖关系
apt-get source PackageName // 下载软件包的源码
apt-get remove PackageName // 删除软件包, 保留配置文件
apt-get --purge remove PackageName // 删除软件包, 同时删除配置文件
apt-get purge PackageName // 删除软件包, 同时删除配置文件
apt-get autoremove PackageName // 删除软件包, 同时删除为满足依赖
// 而自动安装且不再使用的软件包
apt-get --purge autoremove PackageName // 删除软件包, 删除配置文件,
// 删除不再使用的依赖包
apt-get clean && apt-get autoclean // 清除 已下载的软件包 和 旧软件包
apt-get update // 更新安装源(Source)
apt-get upgrade // 更新已安装的软件包
apt-get dist-upgrade // 更新已安装的软件包(识别并处理依赖关系的改变)
deepin下安全MYSQL5.7
正在设置 mysql-client (5.7.21-1) ...
正在设置 mysql-server-5.7 (5.7.21-1) ...
update-alternatives: 使用 /etc/mysql/mysql.cnf 来在自动模式中提供 /etc/mysql/my.cnf (my.cnf)
Renaming removed key_buffer and myisam-recover options (if present)
Created symlink /etc/systemd/system/multi-user.target.wants/mysql.service → /lib/systemd/system/mysql.service.
正在设置 mysql-server (5.7.21-1) ...
正在处理用于 systemd (232-25+deb9u6) 的触发器 ...
sudo cat /etc/mysql/debian.cnf
qfmx520@qfmx520-PC:/etc/mysql/mysql.conf.d$ sudo cat /etc/mysql/debian.cnf
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = debian-sys-maint
password = PvqfuW8Wo5U4q1aO
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = debian-sys-maint
password = PvqfuW8Wo5U4q1aO
socket = /var/run/mysqld/mysqld.sock
qfmx520@qfmx520-PC:/etc/mysql/mysql.conf.d$
用户名 user = debian-sys-maint 密码 password = PvqfuW8Wo5U4q1aO
qfmx520@qfmx520-PC:/etc/mysql/mysql.conf.d$ mysql -u debian-sys-maint -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 12
Server version: 5.7.21-1 (Debian)
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>
### 修改root用户密码
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select host,user,plugin,authentication_string from user;
+-----------+------------------+-----------------------+-------------------------------------------+
| host | user | plugin | authentication_string |
+-----------+------------------+-----------------------+-------------------------------------------+
| localhost | root | auth_socket | |
| localhost | mysql.session | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| localhost | mysql.sys | mysql_native_password | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE |
| localhost | debian-sys-maint | mysql_native_password | *59C1A740854CD296F1861D2720121685CD571D30 |
+-----------+------------------+-----------------------+-------------------------------------------+
4 rows in set (0.00 sec)
# 注:root用户的plugin为auth_socket,密码为空
# 注:root用户的plugin为auth_socket,密码为空
# 使用刚才设置的用户和密码登录系统
qfmx520@qfmx520-PC:/etc/mysql/mysql.conf.d$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13
Server version: 5.7.21-1 (Debian)
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>
# 查看当前数据库编码,发现需要修改的只有2个部分
mysql> show variables like "char%";
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | latin1 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | latin1 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.01 sec)
# 进入MySQL配置文件
fmx520@qfmx520-PC:/etc/mysql/mysql.conf.d$ cd /etc/mysql/mysql.conf.d
fmx520@qfmx520-PC:/etc/mysql/mysql.conf.d$ ls
mysqld.cnf mysqld_safe_syslog.cnf
qfmx520@qfmx520-PC:/etc/mysql/mysql.conf.d$ pwd
/etc/mysql/mysql.conf.d
qfmx520@qfmx520-PC:/etc/mysql/mysql.conf.d$ sudo vim mysqld.cnf #添加代码
[sudo] qfmx520 的密码:
qfmx520@qfmx520-PC:/etc/mysql/mysql.conf.d$ sudo cat mysqld.cnf
------
[mysqld]
#
# * Basic Settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
character-set-server=utf8 # 添加这句代码
#
# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
------
qfmx520@qfmx520-PC:/etc/mysql/mysql.conf.d$ /etc/init.d/mysql restart
[ ok ] Restarting mysql (via systemctl): mysql.service.
qfmx520@qfmx520-PC:/etc/mysql/mysql.conf.d$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.21-1 (Debian)
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 variables like "char%";
+--------------------------+----------------------------+
| Variable_name | Value |
+--------------------------+----------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| character_sets_dir | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.01 sec)
mysql>
# 大功告成
CREATE DATABASE ‘数据库名’ DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;
人生苦短,我用Deepin.png
转载注明出处