Sep 19
浅谈数据库用户表结构设计,第三方登录(转)

说起用户表,大概是每个应用/网站立项动工(码农们)考虑的第一件事情。用户表结构的设计,算是整个后台架构的基石。如果基石不稳,待到后面需求跟进了发现不能应付,回过头来反复修改用户表,要大大小小作改动的地方也不少。与其如此,不妨设计用户表之初就考虑可拓展性,争取不需要太多额外代价的情况下一步到位。

先前设计

id
username
password
用户名加上密码,解决简单需求,留个id作为其他表的外键。当然,那时候密码还可能是明文存储,好点的知道md5。

后来呢,随着业务需求的拓展,要加个用户状态 status  判断用户是否被封禁,注册时间和注册IP地址、上次登录时间和IP地址备查(并衍生出登录记录表,用来判断是否异地登录等,在此不表),用户角色/权限  role  (又衍生出用户角色权限关系,还是另文讨论),业务也需要个人的个人信息如真实姓名、地址等也一股脑往上添加,现在形成了一个很完整的用户关系表。

id
username
password
realname
address

status
role
register_time
register_ip
login_time
login_ip
现在问题来了,进入Web2.0时代,微博开放了第三方网站登录,用微博帐号就能登录我们的网站,老板说,这个我们得要。加个微博用户登录表吧,当然,得和我们自己的用户表关联,这个微博用户信息表如下:

id 自增ID
user_id 关联本站用户ID
uid 微博唯一ID
access_token
access_expire
这还不算完,QQ又开放用户登录了,一下子要接入好多家第三方登录了,只能就着“微博用户信息表”继续加类型加判断,如果是每个第三方登录都新建一个表,肯定会疯的。

时代变了,进入了移动互联网时代,怎么也得支持个手机号登录吧?所以现在每家标配都是:用户名/邮箱/手机号登录,外加一系列微博、微信等第三方登录。表结构如下:

用户表
id
username
email
phone

用户第三方登录表
id
user_id
app_type
app_user_id
access_token

用户在输入框输入用户名/邮箱/手机号和密码之后,后台判断是邮箱、手机号或是用户名,再根据条件查询是否为特定用户。

这个表结构能够承载未来一段时间的业务需求了。如果说某天冒出了一个新的登录方式,比如身份证号登录,怎么办?继续在用户表加字段?我觉得有更好的选择。

改进版

无论username+password,还是phone+password,都是一种用户信息+密码的验证形式;再来理解第三方登录,其实它也是用户信息+密码的形式,用户信息即第三方系统中的ID(第三方登录一定会给一个在他们系统中的唯一标识),密码即access_token,只不过是一种有使用时效定期修改的密码。所以我们把它抽象出了用户基础信息表加上用户授权信息表的形式。

用户基础信息表 users
id
nickname
avatar
用户授权信息表 user_auths
id
user_id
identity_type 登录类型(手机号 邮箱 用户名)或第三方应用名称(微信 微博等)
identifier 标识(手机号 邮箱 用户名或第三方应用的唯一标识)
credential 密码凭证(站内的保存密码,站外的不保存或保存token)
这个系统最大的特色就是,用户信息表不保存任何密码,不保存任何登录信息(如用户名、手机号、邮箱),只留有昵称、头像等基础信息。所有和授权相关(且基本前端展示无关的),都放在用户信息授权表,用户信息表和用户授权表是一对多的关系。说起来太抽象,show  me the code.

users
|id|nickname|avatar|
|1|慕容雪村|http://…/avatar.jpg|
|2|魔力鸟|http://…/avatar2.jpg|
|3|科比|http://…/avatar3.jpg|
user_auths
|id|user_id|identity_type|identifier|credential|
|1|1|email|123@example.com|password_hash(密码)|
|2|1|phone|13888888888|password_hash(密码)|
|3|1|weibo|微博UID|微博access_token|
|4|2|username|moliniao|password_hash(密码)|
|5|3|weixin|微信UserName|微信token|
说说具体处理,用户发来邮箱/用户名/手机号和密码请求登录的时候,依然是先判断类型,以某用户使用了手机号登录为例,使用 SELECT * FROM  user_auths WHERE type=’phone’ and identifier=’手机号’  查找条目,如有,取出并判断password_hash(密码)是否和该条目的credential相符,相符则通过验证,随后通过user_id获取用户信息。

如果使用第三方登录,则只要判断 SELECT * FROM user_auths WHERE type=’weixin’ and  identifier=’微信UserName’  ,如果有记录,则直接登录成功,使用新的token更新原token。假设与微信服务器通信不被劫持的情况下无需判断凭证问题。

通过这个表结构设计,使许多原来纠结的问题瞬间解决,说说优点吧

一,站内登录类型无限拓展,代码改动小。如果真要支持身份证登录了,只要少许几处改动,无需修改表结构。

二,第三方登录类型可用工场模式批量拓展,新增第三方登录类型的开发成本降到最低。

三,原来条件下,应用需要验证手机号是否已验证和邮箱是否已验证,需要相对应多一个字段如 phone_verified 和  email_verified,如今只要在user_auths表中增加一个统一的verified字段,每种登录方式都可以直观看到是否已验证情况。基于信任第三方登录的数据准确性,默认第三方登录都是已验证。如果用户修改登录手机号或登录邮箱,也能清晰跟踪每一步的完成度。

四,可按需绑定任意数量的同类型登录方式,即一个用户可以绑定多个微信,可以有多个邮箱,可以有多个手机号,是不是很赞?当然你也可以限制一种登录方式只有一条记录。

五,在user_auths添加相应的时间和IP地址,就可以更加完整地跟踪用户的使用习惯,比如,已经不使用微博登录两年多,已经绑定微信300天

六,即使完全使用第三方帐号登录,可在前端做到“无需注册本站帐号”的效果。过去许多网站虽然支持第三方帐号登录,但出于留存用户等原因,第一次微博登录回来,让你再填写一套他们网站的邮箱、密码等信息,也就失去了微博登录的最大意义。从技术上说,原有的结构导致除了在微博用户表建立一个条目外,必须在用户表建立一条对应的条目,而且一般情况下不能让用户表里的邮箱或者用户名和密码留空。用户体验好的,邮箱自动生成  微博ID@id.weibo.sina.com  ,密码则随机生成。至于体验不好的,只能说早知道还不如不用微博登录呢!现在呢,我们的这个用户表结构则完全没有这样的困扰,只要微博提供的昵称和头像地址就可以生成这个用户,再关联他的微博登录记录。而且我们的表结构意味着,用户可以解除他的所有登录方式,于是这个账户变彻底变成了没法登录的僵尸(解决办法是在代码里加一个限制,至少保留一条user_auths的记录)。如果你非得得到用户的邮箱,那么每次登录的时候看到他不存在一条identify_type为email的记录,则弹窗弹死他,让他赶快填邮箱,否则啥都别干。

七,提升了逻辑思维能力。抽象出事物本质是码农必备职业素养,通过对用户表结构的学习研究,提高了鄙人的各方面技能,从此写代码一路顺风顺水…

八,如果你说邮箱和手机号就是用户信息的组成部分,他们依然需要体现在users表中作为前端展示?没问题,users表尽管拓展,users表里依然有email,phone,但他们仅仅作为“展示用途”,和昵称、头像、或者性别这些属性没有本质区别。在用户信息表与用户授权登录拆分后,用户信息表可以随时增加任意字段,加星座,加生日,都没问题,只需要在前端展示时多几个输入框,录入时多几行代码,与用户登录相关的问题做到最大程度解耦。

有利必有弊,说说缺点。

一,原先的用户判断由1次SQL变成2次SQL请求。

二,用户同时存在邮箱、用户名、手机号等多种站内登录方式时,改密码时必须一起改,否则就变成了邮箱+新密码,手机号+旧密码访问了,肯定是很诡异的情况。如果考虑到这一点,又要在user_auths表中新增一个表示站内登录方式或第三方登录方式的标识字段。

三,代码量增加了,有些情况下逻辑判断增加了,难度增大了。举个例子,无论用户是否已登录,无论用户是否已注册过,都是点击同一链接前往微博第三方授权后返回,可能出现几种情况:1,该微博在本站未注册过,很好,直接给他注册关联并登录;2,该微博已经在本站存在,当前用户未登录,直接登录成功;3,该微博未在本站注册,但当前用户已经登录并关联的是另一个微博帐号,作何处理取决于是否允许绑定多个微博帐号;4,该微博未在本站注册过,当前用户已登录,尝试进行绑定操作;5,该微博已经注册,用户又已使用该帐号登录,为何他重复绑定自己-  -.  6,该微博已经在本站存在,但当前用户已经登录并关联的是另一个微博帐号,作何处理?切换用户或是报错?(画一个流程图能更好描述这个问题)这个问题与采用的数据结构没有关系,只是在做第三方帐号注册登录时遇到的各种情况,在此一并整理。

about-user-table-desiger

from:https://www.cnblogs.com/jiqing9006/p/5937733.html

Tags:
Sep 8

phpstudy2018本地配置教程You don't have permission to access解决
之前使用旧版本好好的,怎么新的phpstudy2018 新建网站访问会爆如下错误
Forbidden
You don't have permission to access /laravel5/ on this server.

首先有两种情况导致该问题产生
第一种情况,没有选择面板中的【其他选项菜单】-【phpstudy设置】-【允许目录列表】。
以下是官方给出的解答。
新版phpStudy为了安全,取消Apache和nginx列出目录内容。

phpStudy如何禁止或允许站点目录列表

请使用『其他选项菜单』-『phpStudy设置』-『允许目录列表』,打上对勾表示允许目录列表,去掉对勾表示禁止目录列表。

第二种情况,配置多域名的虚拟主机。
phpStudy如何添加多站点,站点域名设置

请使用『其他选项菜单』-『站点域名管理』。

反思
使用第三方工具包时,还是多看看提供的帮助文档,要不然自己配置Apache折腾了半天,搜了半天百度都没找能解决问题的有效方法,原来网上找的配置没错,不过还是没有效果,是第三方工具自己限制的问题。
phpstudy2018-no-have-permission-to-access
来源网络

Tags: ,
Sep 8
window下通过composer 安装laravel5记录
how-window-composer-install-laravel5
前提:
1、已经安装composer
2、可以联网
3、安装php7

进入要安装在目录执行composer create-project laravel/laravel laravel5
记录如下

C:\Users\Administrator.LBDZ-20140426SP>cd /d F:\phpStudy\PHPTutorial\WWW                                                              F:\phpStudy\PHPTutorial\WWW>composer create-project laravel/laravel laravel5
Installing laravel/laravel (v5.7.0)
   - Installing laravel/laravel (v5.7.0): Downloading (100%)                    
Created project in laravel5                                                    
> @php -r "file_exists('.env') || copy('.env.example', '.env');"                
Loading composer repositories with package information                          
Updating dependencies (including require-dev)                                  
Package operations: 71 installs, 0 updates, 0 removals                            
- Installing vlucas/phpdotenv (v2.5.1): Downloading (100%)                      
- Installing symfony/css-selector (v4.1.4): Downloading (100%)                  
- Installing tijsverkoyen/css-to-inline-styles (2.2.1): Downloading (connectinDownloading (100%)                                      - Installing symfony/polyfill-php72 (v1.9.0): Downloading (100%)                
- Installing symfony/polyfill-mbstring (v1.9.0): Downloading (100%)            
- Installing symfony/var-dumper (v4.1.4): Downloading (100%)                    
- Installing symfony/routing (v4.1.4): Downloading (100%)                      
- Installing symfony/process (v4.1.4): Downloading (100%)                      
- Installing symfony/polyfill-ctype (v1.9.0): Downloading (100%)                
- Installing symfony/http-foundation (v4.1.4): Downloading (100%)              
- Installing symfony/event-dispatcher (v4.1.4): Downloading (100%)              - Installing psr/log (1.0.2): Downloading (100%)                                - Installing symfony/debug (v4.1.4): Downloading (100%)                         - Installing symfony/http-kernel (v4.1.4): Downloading (100%)                   - Installing symfony/finder (v4.1.4): Downloading (100%)                        - Installing symfony/console (v4.1.4): Downloading (100%)                       - Installing doctrine/lexer (v1.0.1): Downloading (100%)                        - Installing egulias/email-validator (2.1.5): Downloading (100%)                - Installing swiftmailer/swiftmailer (v6.1.2): Downloading (100%)               - Installing paragonie/random_compat (v9.99.99): Downloading (100%)             - Installing ramsey/uuid (3.8.0): Downloading (100%)                            - Installing psr/simple-cache (1.0.1): Downloading (100%)                       - Installing psr/container (1.0.0): Downloading (100%)                          - Installing symfony/translation (v4.1.4): Downloading (100%)                   - Installing nesbot/carbon (1.33.0): Downloading (100%)                         - Installing monolog/monolog (1.23.0): Downloading (100%)                       - Installing league/flysystem (1.0.46): Downloading (100%)                      - Installing erusev/parsedown (1.7.1): Downloading (100%)                       - Installing dragonmantank/cron-expression (v2.2.0): Downloading (connecting..Downloading (100%)                                                                - Installing doctrine/inflector (v1.3.0): Downloading (100%)                    - Installing laravel/framework (v5.7.2): Downloading (100%)                     - Installing fideloper/proxy (4.0.0): Downloading (100%)                        - Installing nikic/php-parser (v4.0.3): Downloading (100%)                      - Installing jakub-onderka/php-console-color (0.1): Downloading (connecting...Downloading (100%)                                                                - Installing jakub-onderka/php-console-highlighter (v0.3.2): Downloading (connDownloading (100%)                                                                - Installing dnoegel/php-xdg-base-dir (0.1): Downloading (100%)                 - Installing psy/psysh (v0.9.8): Downloading (100%)                             - Installing laravel/tinker (v1.0.7): Downloading (100%)                        - Installing beyondcode/laravel-dump-server (1.2.1): Downloading (connecting..Downloading (100%)                                                                - Installing fzaninotto/faker (v1.8.0): Downloading (100%)                      - Installing hamcrest/hamcrest-php (v2.0.0): Downloading (100%)                 - Installing mockery/mockery (1.1.0): Downloading (100%)                        - Installing filp/whoops (2.2.0): Downloading (100%)                            - Installing nunomaduro/collision (v2.0.3): Downloading (100%)                  - Installing sebastian/version (2.0.1): Downloading (100%)                      - Installing sebastian/resource-operations (1.0.0): Downloading (connecting...Downloading (100%)                                                                - Installing sebastian/object-reflector (1.1.1): Downloading (100%)             - Installing sebastian/recursion-context (3.0.0): Downloading (100%)            - Installing sebastian/object-enumerator (3.0.3): Downloading (100%)            - Installing sebastian/global-state (2.0.0): Downloading (100%)                 - Installing sebastian/exporter (3.1.0): Downloading (100%)                     - Installing sebastian/environment (3.1.0): Downloading (100%)                  - Installing sebastian/diff (3.0.1): Downloading (100%)                         - Installing sebastian/comparator (3.0.2): Downloading (100%)                   - Installing phpunit/php-timer (2.0.0): Downloading (100%)                      - Installing phpunit/php-text-template (1.2.1): Downloading (100%)              - Installing phpunit/php-file-iterator (2.0.1): Downloading (100%)              - Installing theseer/tokenizer (1.1.0): Downloading (100%)                      - Installing sebastian/code-unit-reverse-lookup (1.0.1): Downloading (connectiDownloading (100%)                                                                - Installing phpunit/php-token-stream (3.0.0): Downloading (100%)               - Installing phpunit/php-code-coverage (6.0.7): Downloading (100%)              - Installing doctrine/instantiator (1.1.0): Downloading (100%)                  - Installing webmozart/assert (1.3.0): Downloading (100%)                       - Installing phpdocumentor/reflection-common (1.0.1): Downloading (connecting.Downloading (100%)                                                                - Installing phpdocumentor/type-resolver (0.4.0): Downloading (100%)            - Installing phpdocumentor/reflection-docblock (4.3.0): Downloading (connectinDownloading (100%)                                                                - Installing phpspec/prophecy (1.8.0): Downloading (100%)                       - Installing phar-io/version (2.0.1): Downloading (100%)                        - Installing phar-io/manifest (1.0.3): Downloading (100%)                       - Installing myclabs/deep-copy (1.8.1): Downloading (100%)                      - Installing phpunit/phpunit (7.3.4): Downloading (100%)                      symfony/var-dumper suggests installing ext-intl (To show region name in time zone dump)                                                                         symfony/routing suggests installing doctrine/annotations (For using the annotation loader)                                                                      symfony/routing suggests installing symfony/config (For using the all-in-one router or any loader)                                                              symfony/routing suggests installing symfony/dependency-injection (For loading routes from a service)                                                            symfony/routing suggests installing symfony/expression-language (For using expression matching)                                                                 symfony/routing suggests installing symfony/yaml (For using the YAML loader)    symfony/event-dispatcher suggests installing symfony/dependency-injection       symfony/http-kernel suggests installing symfony/browser-kit                     symfony/http-kernel suggests installing symfony/config                          symfony/http-kernel suggests installing symfony/dependency-injection            symfony/console suggests installing symfony/lock                                egulias/email-validator suggests installing ext-intl (PHP Internationalization Libraries are required to use the SpoofChecking validation)                      swiftmailer/swiftmailer suggests installing ext-intl (Needed to support internationalized email addresses)                                                      swiftmailer/swiftmailer suggests installing true/punycode (Needed to support internationalized email addresses, if ext-intl is not installed)                   paragonie/random_compat suggests installing ext-libsodium (Provides a modern crypto API that can be used to generate random bytes.)                             ramsey/uuid suggests installing ircmaxell/random-lib (Provides RandomLib for use with the RandomLibAdapter)                                                     ramsey/uuid suggests installing ext-libsodium (Provides the PECL libsodium extension for use with the SodiumRandomGenerator)                                    ramsey/uuid suggests installing ext-uuid (Provides the PECL UUID extension for use with the PeclUuidTimeGenerator and PeclUuidRandomGenerator)                  ramsey/uuid suggests installing moontoast/math (Provides support for converting UUID to 128-bit integer (in string form).)                                      ramsey/uuid suggests installing ramsey/uuid-doctrine (Allows the use of Ramsey\Uuid\Uuid as Doctrine field type.)                                               ramsey/uuid suggests installing ramsey/uuid-console (A console application for generating UUIDs with ramsey/uuid)                                               symfony/translation suggests installing symfony/config                          symfony/translation suggests installing symfony/yaml                            monolog/monolog suggests installing aws/aws-sdk-php (Allow sending log messages to AWS services like DynamoDB)                                                  monolog/monolog suggests installing doctrine/couchdb (Allow sending log messages to a CouchDB server)                                                           monolog/monolog suggests installing ext-amqp (Allow sending log messages to an AMQP server (1.0+ required))                                                     monolog/monolog suggests installing ext-mongo (Allow sending log messages to a MongoDB server)                                                                  monolog/monolog suggests installing graylog2/gelf-php (Allow sending log messages to a GrayLog2 server)                                                         monolog/monolog suggests installing mongodb/mongodb (Allow sending log messages to a MongoDB server via PHP Driver)                                             monolog/monolog suggests installing php-amqplib/php-amqplib (Allow sending log messages to an AMQP server using php-amqplib)                                    monolog/monolog suggests installing php-console/php-console (Allow sending log messages to Google Chrome)                                                       monolog/monolog suggests installing rollbar/rollbar (Allow sending log messages to Rollbar)                                                                     monolog/monolog suggests installing ruflin/elastica (Allow sending log messages to an Elastic Search server)                                                    monolog/monolog suggests installing sentry/sentry (Allow sending log messages to a Sentry server)                                                               league/flysystem suggests installing ext-fileinfo (Required for MimeType)       league/flysystem suggests installing ext-ftp (Allows you to use FTP server storage)                                                                             league/flysystem suggests installing league/flysystem-aws-s3-v2 (Allows you to use S3 storage with AWS SDK v2)                                                  league/flysystem suggests installing league/flysystem-aws-s3-v3 (Allows you to use S3 storage with AWS SDK v3)                                                  league/flysystem suggests installing league/flysystem-azure (Allows you to use Windows Azure Blob storage)                                                      league/flysystem suggests installing league/flysystem-cached-adapter (Flysystem adapter decorator for metadata caching)                                         league/flysystem suggests installing league/flysystem-eventable-filesystem (Allows you to use EventableFilesystem)                                              league/flysystem suggests installing league/flysystem-rackspace (Allows you to use Rackspace Cloud Files)                                                       league/flysystem suggests installing league/flysystem-sftp (Allows you to use SFTP server storage via phpseclib)                                                league/flysystem suggests installing league/flysystem-webdav (Allows you to use WebDAV storage)                                                                 league/flysystem suggests installing league/flysystem-ziparchive (Allows you to use ZipArchive adapter)                                                         league/flysystem suggests installing spatie/flysystem-dropbox (Allows you to use Dropbox storage)                                                               league/flysystem suggests installing srmklive/flysystem-dropbox-v2 (Allows you to use Dropbox storage for PHP 5 applications)                                   laravel/framework suggests installing aws/aws-sdk-php (Required to use the SQS queue driver and SES mail driver (^3.0).)                                        laravel/framework suggests installing doctrine/dbal (Required to rename columns and drop SQLite columns (^2.6).)                                                laravel/framework suggests installing ext-pcntl (Required to use all features of the queue worker.)                                                             laravel/framework suggests installing ext-posix (Required to use all features of the queue worker.)                                                             laravel/framework suggests installing guzzlehttp/guzzle (Required to use the Mailgun and Mandrill mail drivers and the ping methods on schedules (^6.0).)       laravel/framework suggests installing league/flysystem-aws-s3-v3 (Required to use the Flysystem S3 driver (^1.0).)                                              laravel/framework suggests installing league/flysystem-cached-adapter (Required to use the Flysystem cache (^1.0).)                                             laravel/framework suggests installing league/flysystem-rackspace (Required to use the Flysystem Rackspace driver (^1.0).)                                       laravel/framework suggests installing league/flysystem-sftp (Required to use the Flysystem SFTP driver (^1.0).)                                                 laravel/framework suggests installing moontoast/math (Required to use ordered UUIDs (^1.1).)                                                                    laravel/framework suggests installing nexmo/client (Required to use the Nexmo transport (^1.0).)                                                                laravel/framework suggests installing pda/pheanstalk (Required to use the beanstalk queue driver (^3.0).)                                                       laravel/framework suggests installing predis/predis (Required to use the redis cache and queue drivers (^1.0).)                                                 laravel/framework suggests installing pusher/pusher-php-server (Required to use the Pusher broadcast driver (^3.0).)                                            laravel/framework suggests installing symfony/dom-crawler (Required to use most of the crawler integration testing tools (^4.1).)                               laravel/framework suggests installing symfony/psr-http-message-bridge (Required to psr7 bridging features (^1.0).)                                              psy/psysh suggests installing ext-pcntl (Enabling the PCNTL extension makes PsySH a lot happier :))                                                             psy/psysh suggests installing ext-posix (If you have PCNTL, you'll want the POSIX extension as well.)                                                           psy/psysh suggests installing ext-pdo-sqlite (The doc command requires SQLite to work.)                                                                         psy/psysh suggests installing hoa/console (A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit.)                                                                               filp/whoops suggests installing whoops/soap (Formats errors as SOAP responses)  sebastian/global-state suggests installing ext-uopz (*)                         phpunit/php-code-coverage suggests installing ext-xdebug (^2.6.0)               phpunit/phpunit suggests installing phpunit/php-invoker (^2.0)                  phpunit/phpunit suggests installing ext-soap (*)                                phpunit/phpunit suggests installing ext-xdebug (*)                              Writing lock file                                                               Generating optimized autoload files                                             > Illuminate\Foundation\ComposerScripts::postAutoloadDump                       > @php artisan package:discover                                                 Discovered Package: beyondcode/laravel-dump-server                              Discovered Package: fideloper/proxy                                             Discovered Package: laravel/tinker                                              Discovered Package: nesbot/carbon                                               Discovered Package: nunomaduro/collision                                        Package manifest generated successfully.                                        > @php artisan key:generate                                                     Application key [base64:4qM4I6Fxf1o/NjYtnD9Cq7l184K1RM6wws+1spuw3ws=] set successfully.                                                              F:\phpStudy\PHPTutorial\WWW>

现在通过http://localhost/laravel5/public,出现下面的内容,就表示已经初步安装完成了。                                                      





如果碰到
phpstudy2018本地配置教程You don't have permission to access解决 参考
http://itlife365.com/blog/post/phpstudy2018-no-have-permission-to-access.php

Sep 4
解决 mysql ERROR 1017:Can't find file: '/xxx.frm' 错误0013
出现这个问题的原因不是'/xxx.frm'这个文件不见了,而是这些文件的权限(应该要是mysql)不知道为什么变成了root。
解决方法:cd到xxx.frm文件所在目录下,执行一下命令:chown mysql mysql * 将所有文件的权限都改过来就可以了!
MySql的MyiSAM表很有可能会出现
Tags:
Jun 30
Linuxcentos 根目录爆满解决(/dev/mapper/centos-root 100%问题)
一、使用df -h命令查看,发现/根目录的剩余空间为0。总共系统盘容量才20G。一般默认空间必须小
二、使用du -h -x --max-depth=1  查看哪个目录占用过高,对于过高目录中的内容适当删减腾出一些空间
三、CentOS 7 调整 home分区扩大 root分区
总体过程:
把/home内容备份,然后将/home文件系统所在的逻辑卷删除,扩大/root文件系统,新建/home ,恢复/home内容
dev/mapper/centos-root 100
Tags:
分页: 7/290 第一页 上页 2 3 4 5 6 7 8 9 10 11 下页 最后页 [ 显示模式: 摘要 | 列表 ]