前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >萌新尝鲜,超越Windows的Deepin

萌新尝鲜,超越Windows的Deepin

作者头像
暖月寒星
发布2020-03-12 16:21:48
4590
发布2020-03-12 16:21:48
举报
文章被收录于专栏:浅枫沐雪

1. 深度系统更新源

同ubuntu一样,深度系统也是使用apt-get安装软件,配置源的方式同Ubuntu配置源与安装软件,更换deepin的源就行

代码语言:javascript
复制
# 使用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常用命令


查询软件包

代码语言:javascript
复制
dpkg -l                             // 列出已安装的所有软件包
apt-cache search PackageName        // 搜索软件包
apt-cache show PackageName          // 获取软件包的相关信息, 如说明、大小、版本等
apt-cache depends PackageName       // 查看该软件包需要哪些依赖包
apt-cache rdepends PackageName      // 查看该软件包被哪些包依赖
apt-get check                       // 检查是否有损坏的依赖

安装软件包

代码语言:javascript
复制
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                  // 下载软件包的源码

卸载软件包

代码语言:javascript
复制
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      // 清除 已下载的软件包 和 旧软件包

更新软件包

代码语言:javascript
复制
apt-get update                  // 更新安装源(Source)
apt-get upgrade                 // 更新已安装的软件包
apt-get dist-upgrade            // 更新已安装的软件包(识别并处理依赖关系的改变)

deepin下安全MYSQL5.7


deepin安装mysql5.7

  • 卸载系统原有的MySQL机器依赖 apt-get autoremove --purge mysql-server-版本号 apt-get autoremove mysql-server apt-get remove mysql-common dpkg -l |grep ^rc|awk '{print $2}' |sudo xargs dpkg -P
  • 使用自带的apt-get安装mysql sudo apt-get install mysql-server mysql-client
代码语言:javascript
复制
正在设置 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) 的触发器 ...
  • 查看MySQL自动生成的密码

sudo cat /etc/mysql/debian.cnf

代码语言:javascript
复制
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$ 
  • 启动MySQL服务 sudo systemctl start mysql
  • 修改mysql密码和用户

用户名 user = debian-sys-maint 密码 password = PvqfuW8Wo5U4q1aO

代码语言:javascript
复制
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用户密码

代码语言:javascript
复制
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,密码为空
  • 更新密码 mysql> update user set plugin="mysql_native_password",authentication_string=password('root') where user="root"; Query OK, 1 row affected, 1 warning (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 1 mysql> mysql> select host,user,plugin,authentication_string from user; ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql> select host,user,plugin,authentication_string from user' at line 1 mysql> select host,user,plugin,authentication_string from user; +-----------+------------------+-----------------------+-------------------------------------------+ | host | user | plugin | authentication_string | +-----------+------------------+-----------------------+-------------------------------------------+ # 更新成功 | localhost | root | mysql_native_password | *81F5E21E35407D884A6CD4A731AEBFB6AF209E1B | | 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) mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.00 sec)

# 使用刚才设置的用户和密码登录系统

代码语言:javascript
复制
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)
代码语言:javascript
复制
# 进入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.
------

重启MySQL服务 登录用户查看字符集

代码语言:javascript
复制
qfmx520@qfmx520-PC:/etc/mysql/mysql.conf.d$ /etc/init.d/mysql restart

[ ok ] Restarting mysql (via systemctl): mysql.service.
代码语言:javascript
复制
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


转载注明出处


本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2019-05-19,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1. 深度系统更新源
  • 查询软件包
  • 安装软件包
  • 卸载软件包
  • 更新软件包
  • deepin安装mysql5.7
  • 重启MySQL服务 登录用户查看字符集
  • 不想设置以上或者可以这样直接创建数据库
相关产品与服务
云数据库 SQL Server
腾讯云数据库 SQL Server (TencentDB for SQL Server)是业界最常用的商用数据库之一,对基于 Windows 架构的应用程序具有完美的支持。TencentDB for SQL Server 拥有微软正版授权,可持续为用户提供最新的功能,避免未授权使用软件的风险。具有即开即用、稳定可靠、安全运行、弹性扩缩等特点。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档