s查找mysql服务_MySQL菜鸟实录(一):MySQL服务安装实战

CentOS 7

基本信息

系统版本: CentOS 7.3 64bit

系统配置: 4vCPUs | 8GB

磁盘空间:

[root@ecs-ce5a-0001 ~]# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/vda1 40G 17G 22G 44% /

devtmpfs 3.9G 0 3.9G 0% /dev

tmpfs 3.9G 0 3.9G 0% /dev/shm

tmpfs 3.9G 25M 3.8G 1% /run

tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup

tmpfs 783M 0 783M 0% /run/user/0

/dev/vdb1 493G 70M 467G 1% /data

[root@ecs-ce5a-0001 ~]#

检查历史残留

使用rpm查询功能,查询本机是否有安装过MySQL(由于安装事后若是不完全卸载的话,会致使后续安装出现一些异常问题,因此为了保险起见仍是先检查一下为好):html

# 没有装过MySQL的主机

[root@ecs-ce5a-0001 ~]# rpm -qa|grep -i mysql

[root@ecs-ce5a-0001 ~]#

# 以前装过MySQL的主机

[root@mserver0002 img]# rpm -qa|grep -i mysql

mysql-community-common-5.7.24-1.el6.x86_64

mysql-community-client-5.7.24-1.el6.x86_64

mysql-community-libs-5.7.24-1.el6.x86_64

mysql-community-server-5.7.24-1.el6.x86_64

[root@mserver0002 img]#

若发现有历史安装痕迹,那么就要进行下一步的清理操做来清除历史垃圾了,挨个将全部的安装包清理完毕(若出现卸载不掉的能够尝试使用rpm -ev):mysql

[root@mserver0002 img]# yum -y remove mysql-community-common-5.7.24-1.el6.x86_64

[root@mserver0002 img]# yum -y remove xxx

下载安装源

MySQL有个安装源仓库站: http://repo.mysql.com/ ;里面有一大排的安装源连接,这时候可不能找错了,对应于咱们这次安装的CentOS7.3版本咱们选用带el7的源: http://repo.mysql.com/mysql57-community-release-el7-9.noarch.rpm ;这一步切记千万不能大意,下载的版本一旦和系统没法对应,那么接下来的全部操做都是白费工夫,并且还有可能遇到一些意想不到的问题。c++

[root@ecs-ce5a-0001 ~]# cd tmp/

[root@ecs-ce5a-0001 tmp]# ls

[root@ecs-ce5a-0001 tmp]# wget http://repo.mysql.com/mysql57-community-release-el7-9.noarch.rpm

--2018-11-14 10:29:03-- http://repo.mysql.com/mysql57-community-release-el7-9.noarch.rpm

......

2018-11-14 10:29:04 (253 MB/s) - ‘mysql57-community-release-el7-9.noarch.rpm’ saved [9224/9224]

[root@ecs-ce5a-0001 tmp]#

安装mysql-server

在通过上一步将安装源下载到本地以后,接下来就是安装了;先经过rpm将安装源安装后,就能够正式使用yum进行mysql-server的安装了(听说也能够在安装时指定installroot,没有尝试过,通常都是默认安装的),有须要确认的地方之间y就能够了;直至出现“Complete!”意味着安装顺利完成了。sql

[root@ecs-ce5a-0001 tmp]# rpm -ivh mysql57-community-release-el7-9.noarch.rpm

warning: mysql57-community-release-el7-9.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY

Preparing... ################################## [100%]

Updating / installing...

1:mysql57-community-release-el7-9 ################################# [100%]

[root@ecs-ce5a-0001 tmp]#

[root@ecs-ce5a-0001 tmp]# yum -y install mysql-server

Loaded plugins: fastestmirror

Determining fastest mirrors

......

Replaced:

mariadb-libs.x86_64 1:5.5.60-1.el7_5

Complete!

[root@ecs-ce5a-0001 tmp]#

默认配置查看

默认状况下,安装后的配置文件是下面这样子的(咱们能够根据本身的须要将相应的配置补充或者进行修改,好比datadir通常都会设置到专属的数据目录下面去):数据库

[root@ecs-ce5a-0001 tmp]# vim /etc/my.cnf

[mysqld]

# ... some comments

datadir=/var/lib/mysql

socket=/var/lib/mysql/mysql.sock

# Disabling symbolic-links is recommended to prevent assorted security risks

symbolic-links=0

log-error=/var/log/mysqld.log

pid-file=/var/run/mysqld/mysqld.pid

启动服务

启动MySQL服务,当前版本的MySQL在启动时会默认生成一个root用户并提供默认密码,咱们能够在/var/log/mysqld.log文件中获取到默认密码,至此服务正常启动完成,并获取到了默认的root密码。ubuntu

[root@ecs-ce5a-0001 tmp]# service mysqld restart

Redirecting to /bin/systemctl restart mysqld.service

[root@ecs-ce5a-0001 tmp]#

[root@ecs-ce5a-0001 tmp]# grep password /var/log/mysqld.log

2018-11-14T03:07:28.036081Z 1 [Note] A temporary password is generated for root@localhost: 8-8br-HfR4J9

[root@ecs-ce5a-0001 tmp]#

修改密码和赋权

使用默认密码登陆后,发现啥也作不了,必须修改密码,因此使用了alter来进行密码修改(密码要求比早版本的严格了不少,长度、特殊字符、字母和数字都有要求),关于赋权,后面的补充知识里面会专门稍微详细的说明一下。vim

[root@ecs-ce5a-0001 tmp]# mysql -uroot -p8-8br-HfR4J9

mysql: [Warning] Using a password on the command line interface can be insecure.

......

mysql> use mysql

ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql> alter user 'root'@'localhost' identified by 'smart';

ERROR 1819 (HY000): Your password does not satisfy the current policy requirements

mysql> alter user 'root'@'localhost' identified by 'Smart@123';

Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;

Query OK, 0 rows affected (0.00 sec)

mysql>

CentOS 6

无果的尝试

理论上来讲,CentOS6和CentOS7安装MySQL的步骤应该是一致的,起码大部分的步骤都应该是一致的,可是事实上却并不如此。

按照传统的安装方式,即便在下载repo时选择了正确的平台版本,最后发现仍是在yum -y install mysql-server这一步遇到了缺GLIBC_2.14的问题(相似下面这种),也曾经尝试过本身编译安装这个库,可是没有成功,既然此路不通,那何不另觅新法呢!windows

Error: Package: mysql-community-libs-5.7.17-1.el7.x86_64 (mysql57-community-dmr)

Requires: libc.so.6(GLIBC_2.14)(64bit)

Error: Package: mysql-community-client-5.7.17-1.el7.x86_64 (mysql57-community-dmr)

Requires: libc.so.6(GLIBC_2.14)(64bit)

Error: Package: mysql-community-client-5.7.17-1.el7.x86_64 (mysql57-community-dmr)

Requires: libstdc++.so.6(GLIBCXX_3.4.15)(64bit)

You could try using --skip-broken to work around the problem

另谋出路

既然在线安装会出问题,那么不妨试试传统的安装方式,把安装包下载到本地再手动安装呢?

因而就找到知足咱们系统要求的版本(下载地址: https://dev.mysql.com/downloads/file/?id=481078 ),下载到本地(文件名:mysql-5.7.24-1.el6.x86_64.rpm-bundle.tar,这里的el6就是适配CentOS6的);压缩包里有以下一堆文件:centos

Administrator@IVF21BBAA9XWLKD MINGW64 /e/暂时存放/mysql-5.7.24-1.el6.x86_64.rpm-bundle

$ ls

mysql-community-client-5.7.24-1.el6.x86_64.rpm

mysql-community-common-5.7.24-1.el6.x86_64.rpm

mysql-community-devel-5.7.24-1.el6.x86_64.rpm

mysql-community-embedded-5.7.24-1.el6.x86_64.rpm

mysql-community-embedded-devel-5.7.24-1.el6.x86_64.rpm

mysql-community-libs-5.7.24-1.el6.x86_64.rpm

mysql-community-libs-compat-5.7.24-1.el6.x86_64.rpm

mysql-community-server-5.7.24-1.el6.x86_64.rpm

mysql-community-test-5.7.24-1.el6.x86_64.rpm

接下来就分别按顺序安装common、libs、client、server四个包(其余工具包能够视状况决定是否安装);这里的四个包也是能够一次性安装的(命令如:rpm -ivh pkg1 pkg2 pkg3 pkg4):安全

[root@mserver0002 img]# rpm -ivh mysql-community-common-5.7.24-1.el6.x86_64.rpm

[root@mserver0002 img]# rpm -ivh mysql-community-libs-5.7.24-1.el6.x86_64.rpm

[root@mserver0002 img]# rpm -ivh mysql-community-client-5.7.24-1.el6.x86_64.rpm

[root@mserver0002 img]# rpm -ivh mysql-community-server-5.7.24-1.el6.x86_64.rpm

安装完成后,后面的操做步骤就和CentOS7没什么差别了,无非是改改配置文件,设置密码和权限之类的操做了。

Ubuntu 16

先说两句

早几年Ubuntu的系统使用的仍是挺多的,可是现在不少应用默认都是使用CentOS了,其实孰优孰劣我还真没详细比较过,不过一个比较明显的感受呢,Ubuntu安装软件比起CentOS好像是比较简便一些,更傻瓜式一点,因此都了解一下也没什么坏处。

实际操做

鉴于下载安装个系统仍是要耗费很多精力,因此此次也就偷个小懒,没有实际去验证这个操做了,可是以前由于已经装过不少次Ubuntu环境的MySQL了,结合网上的一些博客说明,大体也就如下几个步骤:

# 先经过以下3条命令完成安装

sudo apt-get install mysql-server

sudo apt install mysql-client

sudo apt install libmysqlclient-dev

# 而后查看一下mysql的端口监听确认服务是否正常启动

sudo netstat -tap | grep mysql

安装到这里就已经算成功了,后面的步骤又是老调重弹了(配置、密码、权限等等),因此也就很少说了。

Windows 10

安装版

貌似在5.5或以前的版本还挺流行安装的,无非是一步步next,到最后设置个root密码,而后就万事大吉;到如今比较新的发行版好像都流行使用免安装的方式了,并且安装版的操做实际上也是小学生级的,只要稍微熟悉电脑操做的,估计装起来都不会遇到啥问题,因此这里就很少说了。

安装版(MSI)的下载地址: https://dev.mysql.com/downloads/windows/installer/8.0.html 。

免安装版

下载安装源

解压安装

将压缩包解压到某个目录下(这里我是在虚拟机里面安装的,因此直接放在C盘根目录下了);而后以管理员权限运行CMD,进入mysql解压目录的bin。

到这里理论上来讲是要配置一下my.ini文件的(也就是Linux版的my.cnf文件),鉴于此次只是作简单的安装实验,因此就略去这一步操做。

接下来在dos窗口运行mysqld --initialize-insecure(注意:这里有坑,参考文章最后的常见错误提供了解决方法)

而后就能够install和start了,出现下面的成功日志即表示服务已经成功启动了。

Microsoft Windows [版本 10.0.10240]

(c) 2015 Microsoft Corporation. All rights reserved.

C:\Windows\system32>cd ../../

C:\>cd mysql-8.0.13-winx64

C:\mysql-8.0.13-winx64>cd bin

C:\mysql-8.0.13-winx64\bin>mysqld --initialize-insecure

C:\mysql-8.0.13-winx64\bin>mysqld -install

Service successfully installed.

C:\mysql-8.0.13-winx64\bin>net start mysql

MySQL 服务正在启动 ..

MySQL 服务已经启动成功。

C:\mysql-8.0.13-winx64\bin>

安装结果验证

在前面的安装操做中咱们一直没有设置root密码,因此在验证以前咱们要设置一下root密码,按照下面的步骤操做便可;密码设置完成后便可登陆进行常规操做,以下即表示安装成功。

C:\mysql-8.0.13-winx64\bin>mysqladmin -u root password Smart@123

mysqladmin: [Warning] Using a password on the command line interface can be insecure.

Warning: Since password will be sent to server in plain text, use ssl connection to ensure password safety.

C:\mysql-8.0.13-winx64\bin>mysql -uroot -p

Enter password: *********

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 10

Server version: 8.0.13 MySQL Community Server - GPL

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 ;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| sys |

+--------------------+

4 rows in set (0.01 sec)

mysql>

补充内容

实际上这种免安装模式是将MySQL注册为Windows的一个服务了,经过查看服务列表咱们能发现这个MySQL服务,也能够控制服务的启动方式、运行状态等等。

5e06a219db954c24888f0ef3.html

怎么卸载?

首先要中止当前正在运行的服务,而后删除mysql目录

而后打开注册表编辑器(regedit),找到并清除如下项:

HKEY_LOCAL_MACHINE/SYSTEM/ControlSet001/Services/Eventlog/Application/MySQLD Service

HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Eventlog/Application/MySQLD Service

最后须要删除已注册到系统中的MySQL服务

C:\Windows\system32>sc delete MySQL

[SC] DeleteService 成功

C:\Windows\system32>

小葵花补充知识点

关于密码规则

MySQL的密码设置有不一样的规则等级,具体说来是跟validate_password_policy这个配置相关的(默认是1,即MEDIUM,因此刚开始设置的密码必须符合长度,且必须含有数字,小写或大写字母,特殊字符。):

Policy

Tests Performed

0 or LOW

Length

1 or MEDIUM

Length; numeric, lowercase/uppercase, and special characters

2 or STRONG

Length; numeric, lowercase/uppercase, and special characters; dictionary file

忘记密码了怎么办?

有时长时间不用某服务器了,猛地有一天想去看看数据却发现密码忘了,非常尴尬吧?这时候就须要用到了skip-grant-tables 这个配置了,在my.cnf中将这个配置项打开而后restart一下服务,就能够不用校验密码登陆mysql服务器了,登陆进去以后再给本身的root从新设置一下密码update mysql.user set authentication_string=password('Smart@123') where user='root' ;,大功告成!

[root@mserver0002 img]# cat /etc/my.cnf

[mysqld]

####basic settings####

#skip-grant-tables

default-storage-engine=INNODB

......

# 修改完配置文件后可使用空密码登陆(在Enter password:出现后直接敲enter键)

[root@ecs-ce5a-0001 etc]# mysql -uroot -p

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

......

mysql> use mysql

Database changed

mysql> SET PASSWORD = PASSWORD('Smart@123');

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Smart@123';

ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

mysql> update mysql.user set password=password('Smart@123') where user= 'root';

ERROR 1054 (42S22): Unknown column 'password' in 'field list'

mysql> desc mysql.user

-> ;

+------------------------+-----------------------------------+------+-----+-----------------------+-------+

| Field | Type | Null | Key | Default | Extra |

+------------------------+-----------------------------------+------+-----+-----------------------+-------+

| Host | char(60) | NO | PRI | | |

......

| authentication_string | text | YES | | NULL | |

| password_expired | enum('N','Y') | NO | | N | |

| password_last_changed | timestamp | YES | | NULL | |

| password_lifetime | smallint(5) unsigned | YES | | NULL | |

| account_locked | enum('N','Y') | NO | | N | |

+------------------------+-----------------------------------+------+-----+-----------------------+-------+

45 rows in set (0.00 sec)

mysql> update mysql.user set authentication_string=password('Smart@123') where user= 'root';

Query OK, 1 row affected, 1 warning (0.00 sec)

Rows matched: 1 Changed: 1 Warnings: 1

mysql> FLUSH PRIVILEGES;

Query OK, 0 rows affected (0.01 sec)

mysql> exit

Bye

[root@ecs-ce5a-0001 etc]# mysql -uroot -p

# 在这里输入新设置的密码Smart@123

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.

......

mysql>

关于赋权的说明

首先说说改密码,其实有下面两种途径均可以;而赋权则会涉及的比较多,能够参考下面的操做样例(关于用户权限管理,这么小小的一段是说不清楚的,后面会单独开新的章节进行详细说明):

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Smart@123';

flush privileges;

SET PASSWORD = PASSWORD('Smart@123');

ALTER USER 'root'@'localhost' PASSWORD EXPIRE NEVER;

flush privileges;

-- root所有赋权

grant all privileges on *.* to root@"%" identified by "Smart@123";

flush privileges;

-- 普通用户部分赋权

grant select,insert,update,delete on db_test.* to test@"%" identified by "Smart@2018";

flush privileges;

查看MySQL版本

有时候不免会有须要查看MySQL版本的需求(好比作库同步时要查看两个服务的版本是否是一致能不能同步之类的),下面提供了4中经常使用的数据库版本查看的方法:

# 方法1

[root@ecs-ce5a-0001 ~]# mysql -V

mysql Ver 14.14 Distrib 5.7.24, for Linux (x86_64) using EditLine wrapper

# 方法2

[root@ecs-ce5a-0001 ~]# mysql --help |grep Distrib

mysql Ver 14.14 Distrib 5.7.24, for Linux (x86_64) using EditLine wrapper

# 方法3

[root@ecs-ce5a-0001 ~]# mysql -uroot -pKoncendy@123

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 12

Server version: 5.7.24-log MySQL Community Server (GPL)

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> select version();

+------------+

| version() |

+------------+

| 5.7.24-log |

+------------+

1 row in set (0.00 sec)

# 方法4

mysql> status

--------------

mysql Ver 14.14 Distrib 5.7.24, for Linux (x86_64) using EditLine wrapper

Connection id:12

Current database:

Current user:root@

SSL:Not in use

Current pager:stdout

Using outfile:''

Using delimiter:;

Server version:5.7.24-log MySQL Community Server (GPL)

Protocol version:10

Connection:Localhost via UNIX socket

Server characterset:utf8

Db characterset:utf8

Client characterset:utf8

Conn. characterset:utf8

UNIX socket:/data/mysql/mysql.sock

Uptime:5 min 21 sec

Threads: 6 Questions: 293 Slow queries: 6 Opens: 195 Flush tables: 1 Open tables: 156 Queries per second avg: 0.912

--------------

mysql>

常见的错误

远程没法访问

一般状况下,有两个可能性比较大的缘由:

bind-address没设置对,端口绑定到127.0.0.1上面去了

云服务器的3306端口没有作安全组规则开放(这个在本地服务器安装不会出现)

目录初始化问题

启动时失败经过journalctl -xe查看发现以下的错入日志,通常出现这个错误表示my.cnf里指定的datadir不是一个空目录(有垃圾文件或者有以前初始化残留的文件);已经初始化,但没有成功,想再次初始化报错;这时须要清理这个目录以后从新尝试启动服务。

...: 2018-11-14T13:43:11.806347+08:00 0 [ERROR] --initialize specified but the data directory has files in it. Aborting.

日志权限的问题

启动时失败经过journalctl -xe查看发现以下的错入日志,实际上就是写日志文件没有权限致使的错误。可是我在执行了[root@ecs-ce5a-0001 etc]# chmod -R 766 /var/log/mysql以后发现启动服务后仍是会报下面的错误,很奇怪(由于766已经对应的是-rwxrw-rw-这个权限级别,能够读写了);后来将766调整为777才能够正常启动服务。(没彻底弄明白为何对日志目录要执行权限?)

...: 2018-11-14T13:44:17.230008+08:00 0 [ERROR] Could not open file '/var/log/mysql/error.log' for error logging: Permission denied

MSVCP140.dll缺失

windows下出现的,在dos窗口运行mysqld --initialize-insecure,这时出现以下提示:

---------------------------

mysqld.exe - 系统错误

---------------------------

没法启动此程序,由于计算机中丢失 MSVCP140.dll。尝试从新安装该程序以解决此问题。

---------------------------

肯定

---------------------------

实际上这个问题是由于没有安装VC++2015版运行库致使的(Microsoft Visual C++ 2015 Redistributable),到以下下载地址 https://www.microsoft.com/en-us/download/details.aspx?id=53587 ,按照本机操做系统的位数肯定下载的包,安装后便可解决此问题。

客户端链接MySQL 8报1251

经过SQLyog或者Navicat链接MySQL发现报1251以下错误提示:

ded5c40752351ab851ac5c5b4c51ceb4.png

百度了一下,缘由是mysql8以前的版本中加密规则是mysql_native_password,在mysql8以后加密规则改为了caching_sha2_password;解决的方法有两种,一种是升级客户端驱动,一种是把mysql用户登陆密码加密规则还原成mysql_native_password;由于我们大多数都是本身想办法搞得客户端,因此就选择第二条路了;操做以下:

# Login

mysqladmin -u root -p

......

# Execute SQL

ALTER USER 'root'@'localhost' IDENTIFIED BY 'password' PASSWORD EXPIRE NEVER;

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'admin123';

FLUSH PRIVILEGES;

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/542698.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

实验一 线性表的顺序存储与实现_【自考】数据结构中的线性表,期末不挂科指南,第2篇

线性表这篇博客写的是线性表相关的内容,包括如下部分,先看下有木有期待啥是线性表线性表的顺序存储线性表的基本运算在顺序表上的实现线性表的链式存储线性表的基本运算在单链表上的实现循环链表与双向循环链表Over,内容还蛮多的!…

二叉树打印叶子节点,非递归_使用递归打印链接列表中的备用节点

二叉树打印叶子节点,非递归Solution: 解: Input: A singly linked list whose address of the first node is stored in a pointer, say head 输入:一个单链表 ,其第一个节点的地址存储在指针中,例如head Output: The alternati…

TYVJ P1012 火柴棒等式 Label:枚举

背景 NOIP2008年提高组第二题描述 给你n根火柴棍,你可以拼出多少个形如“ABC”的等式?等式中的A、B、C是用火柴棍拼出的整数(若该数非零,则最高位不能是0)。用火柴棍拼数字0-9的拼法如图所示:注意&#xff…

java math max_Java Math类静态double max(double d1,double d2)示例

java math max数学类静态double max(double d1,double d2) (Math Class static double max(double d1,double d2) ) This method is available in java.lang package. 此方法在java.lang包中可用。 This method is used to return the maximum one of both the give…

python怎么开发软件_怎么使用python进行软件开发

一、下载pyinstaller 我使用的版本为PyInstaller-2.1,支持python版本2.3-2.7,点击这里下载。 二、安装pyinstaller 下载完成后,解压即可。我的解压目录为D:\Python27\PyInstaller-2.1\ 三、使用pyinstaller打包.py成.exe应用程序 1.注意使用前…

28、清华大学脑机接口实验组SSVEP数据集:通过视觉触发BCI[飞一般的赶脚!]

前言: 哈喽,最近对清华大学脑机接口的数据进行了尝试,输入到了DL模型中,以下是本人对于清华BCI数据的个人见解。 数据地址: 清华大学脑机接口研究组 (tsinghua.edu.cn) 打开网站可以看到有很多个数据,官…

python Pexpect

http://www.cnblogs.com/dkblog/archive/2013/03/20/2970738.htmlhttp://www.ibm.com/developerworks/cn/linux/l-cn-pexpect2/index.htmlhttp://www.cnblogs.com/dkblog/archive/2013/03/20/2970738.htmlpython Pexpect Pexpect 是一个用来启动子程序并对其进行自动控制的纯 P…

python 幂运算 整数_在Python中检查一个数字是否是另一个数字的幂

python 幂运算 整数To solve this problem simply, we will use the log() function from the math module. The math module provides us various mathematical operations and here we will use the log() function from this module. In Python working of log() function, …

3dmax镜像后模型线条乱了_3dMax入门教程来啦!小白赶紧收藏!

3D Studio Max,常简称为3d Max或3ds MAX,是Discreet公司开发的(后被Autodesk公司合并)基于PC系统的三维动画渲染和制作软件, 3dmax软件主要功能有建模,动画,渲染,特效等,…

java中哲学家就餐死锁_哲学家就餐问题与死锁总结

死锁的四个条件:(1) 互斥条件:一个资源每次只能被一个进程使用。(2) 请求与保持条件:一个进程因请求资源而阻塞时,对已获得的资源保持不放。(3) 不剥夺条件:进程已获得的资源,在末使用完之前,不能强行剥夺。…

linux扫描工具之nmap

Linux下有很多强大网络扫描工具,网络扫描工具可以分为:主机扫描、主机服务扫描、路由扫描等,nmap支持批量主机扫描和主机服务扫描。检测安装:[rootbier ~]# rpm -qa nmap nmap-5.51-4.el6.x86_64如果没有安装就安装一下nmap的安装直接使用&am…

如何将多个一维列表转化为二维列表_数据分析2_如何处理一维、二维数据

吞一块大饼,还不如切成小块吃得香常见的数据集,要么是数列,要么是表格;因此,数据分析最首要的是,处理一维、二维数据。主要知识点可参考如图。如需要,可点击以下百度网盘链接下载数据分析基础知…

关于java中锁的面试题_Java面试题-Java中的锁

1. 如何实现乐观锁(CAS)?如何避免ABA问题?答:1)读取内存值的方式实现了乐观锁(比如:SVN系统),方法:第一,比较内存值和期望值;第二,替换内存值为要替换值。2)带参数版本来…

NSUserDefaults

2019独角兽企业重金招聘Python工程师标准>>> NSUserDefaults 转载于:https://my.oschina.net/18829297883/blog/737931

什么是算术运算和逻辑运算_8086微处理器的算术和逻辑运算

什么是算术运算和逻辑运算逻辑指令 (Logical Instructions) a) AND: Logical AND a)AND:逻辑AND Atleast one of the operant should be a register or a memory operant both the operant cannot be a memory location or immediate operant. 操作中的至少一个应该…

python文件读写用到的库_Python使用pyshp库读取shapefile信息的方法

通过pyshp库,可以读写shapefile文件,查询相关信息,github地址为 import shapefile # 使用pyshp库 file shapefile.reader("data\\市界.shp") shapes file.shapes() # print(file.shapetype) # 输出shp类型null 0 point 1 poly…

h5引入json_Vue中如何使用本地Json文件?

我需要将菜单配置成Json文件,然后再程序中引入{{menu.name}}import menuListConfig from ../../config/menu.jsonexport default {name: "Sider",data(){return {menuList:JSON.parse(JSON.stringify(menuListConfig))}}}需要如何做,才能v-for…

深入学习jQuery选择器系列第四篇——过滤选择器之属性选择器

前面的话 属性过滤选择器的过滤规则是通过元素的属性来获取相应的元素,对应于CSS中的属性选择器。属性过滤选择器可分为简单属性选择器、具体属性选择器和条件属性选择器三种。本文将详细该部分内容 简单属性选择器 [attribute] [attribute]选择器选择拥有该属性的元…

c++ scanf读取_使用scanf()读取内存地址并在C中打印其值

c scanf读取Here, we have to input a valid memory address and print the value stored at memory address in C. 在这里,我们必须输入一个有效的内存地址并在C中打印存储在内存地址中的值。 To input and print a memory address, we use "%p" format…

python正则匹配_Python正则表达式只匹配一次

我正在尝试创建一个简单的降价乳胶转换器,只是为了学习 python和基本的正则表达式,但我不知道试图弄清楚为什么下面的代码不起作用: re.sub (r\[\*\](.*?)\[\*\]: ?(.*?)$, r\\footnote{\2}\1, s, flagsre.MULTILINE|re.DOTALL) 我想转换像: s "…