欢迎各位兄弟 发布技术文章

这里的技术是共享的

You are here

drush Could not login with user ID #0 有大用

使用 Drush 的时候,报错:Could not login with user ID #0.

用 drush 报错,Could not login with user ID #0.,请问如何解决?

2016-09-19 分享 评论        
           

updown                    
慕容白 向我提问我才会告诉你哦~0 票                    
                   

找到答案了,主要是数据库里面 user 表中,id=0的用户丢失了,可能是由于 mysql dump 数据库的时候出的问题。
具体解决办法参考这个,Drupal 6 7 8的操作都有:


   

来自  http://drupal001.net/question/2499    


   


   

Restore the anonymous (user ID 0) user record

Last updated 12 July 2016. Created on 17 January 2011.
Edited by morbidickazovskykostajhgregglesLog in to edit this page.
                                       

Having the Anonymous user deleted in your site breaks Drupal in unexpected ways, including a message like:

  • "Could not login with user ID #0." error from Drush

  • "warning: Invalid argument supplied for foreach() in /includes/form.inc on line 1181." and various other strange errors from Drupal core

Fixing cases where you accidentally deleted the user

There are many ways to accidentally delete the uid 0 (Anonymous) user: a mistaken query that forgot to use "and uid != 0" or a Views Bulk Operations view that was a little too aggressive.

The technique to fix it depends on a few factors. Below are different techniques that work on Drupal 7 or Drupal 6.

Drupal 8

For Drupal 8, you can run the following query:

INSERT INTO users (uid, langcode, uuid) VALUES (0, "en", "");

                                                   

e.g. via Drush:

drush -u 1 sql-query "INSERT INTO users (uid,  langcode, uuid) VALUES (0, "en", "");"
                                                   

This will insert a new user with uid 0.

Drupal 7

For Drupal 7, you can run two queries:

INSERT INTO users (name, pass, mail, theme, signature, language, init, timezone) VALUES ('', '', '', '', '', '', '', '');
UPDATE users SET uid = 0 WHERE name = '';
                                                   

e.g. via Drush:

drush -u 1 sql-query "INSERT INTO users (name, pass, mail, theme, signature, language, init, timezone) VALUES ('', '', '', '', '', '', '', '')"
drush -u 1 sql-query "UPDATE users SET uid = 0 WHERE name = ''"
                                                   

This will insert a new row getting a random UID and then the update query fixes to get the right uid for the user.

For Drupal 6 using a slightly different technique

You can also insert directly with a specific value for the auto-incrementing UID if you tell your database to use a different SQL_MODE.

This pair of statements will bring the user back on Drupal 6:

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
INSERT INTO `users` (`uid`, `name`, `pass`, `mail`, `mode`, `sort`, `threshold`, `theme`, `signature`, `created`, `access`, `login`, `status`, `timezone`, `language`, `picture`, `init`, `data`) 
VALUES ('0', '', '', '', 0, 0, 0, '', '', 0, 0, 0, 0, NULL, '', '', '', NULL);
                                                   

Check again:
select name, uid from users where name = '';
Output should be like this:

-+------+-----+
-| name | uid |
-+------+-----+
-|      |   0 |
-+------+-----+
-1 row in set (0.00 sec)
                                                   

Fixing cases where the import changed the uid values

Certain database dump programs, such as older versions of phpMyAdmin, do not respect MySQL's SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; directive. The result of this is when importing a faulty database dump, your anonymous user record gets imported as (highest user ID) +1 instead of user ID 0.

Should this happen to you, you can fix your database by issuing the following query:

UPDATE users SET uid = 0 WHERE name = '';
                                                   

To check if this fix applies to you run:

select name, uid
from users
where name = '';
                                                   

Output should be something like this:

-+------+-----+
-| name | uid |
-+------+-----+
-|      |  0 |
-+------+-----+
-1 row in set (0.00 sec)
                                               

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.                                        

Comments

majusz’s picture                                        

Rebuilding search-index not working without user 0                                        

majusz commented 

Thanks for this comment!
It just solved a problem I was trying to fix for the last two days.

I had this issue with a Drupal 6 installation that the search index wasn't properly rebuilt by the usual cron job. After researching a lot and not finding anything helpful, I installed Drush, and Drush told me that it couldn't login as user #0. So I followed the directions above, so that I could use Drush with user #0. After I did that, Drush AND the search indexing worked perfectly fine.

So for everyone having similar problems: the Drupal search index rebuilding engine seems to rely on the Anonymous user as well.

danieltome’s picture                                        

Drush issue                                        

danieltome commented 

If you came to this issue because Drush sent you here:

Drush spits out:

Could not login with user ID #0. This is typically caused by importing a MySQL database dump [error]
from a faulty tool which re-numbered the anonymous user ID in the users table. See
http://drupal.org/node/1029506 for help recovering from this situation.

This was related to a site we built where we do not allow anonymous access. So the homepage displays access denied and the login screen.

Simple solution is to run drush as admin:

Eg clear cache:
drush -u 1 cc all

kraigory’s picture                                            

re: Drush issue                                            

kraigory commented 

Running drush as user 1 worked wonderfully for me.

drush -u 1 cc all

Does anyone know if there are any downsides/dangers to running drush as admin user? If not, is there a way to tell drush to ALWAYS run as admin?

emcniece’s picture                                                

nice                                                

emcniece commented 

Man, I wish there was an upvote system. Nice tip!

dags’s picture                                        

XDebug + PHPStorm                                        

dags commented 

This error suddenly started appearing while I was trying to debug migrations from the command line using XDebug + PHPStorm. The problem was that I had set a bad conditional breakpoint on a line in /includes/entity.inc -- I had used the assignment operator where I should have used the equality operator (ie. $ids=NULL instead of $ids==NULL). Big facepalm. Be careful when using debuggers!

m1r1k’s picture                                        

Well, as now Drupal 7 has                                        

m1r1k commented 

Well, as now Drupal 7 has INNER JOIN to user_revision table, we have to keep connection between users and user_revision tables on vid, otherwise user_load won't return any user.

rooby’s picture                                            

Only if you are using the user revision module                                            

rooby commented 

Only if you are using the user revision module.

highermath’s picture                                            

This was exactly my issue.                                            

highermath commented 

This was exactly my issue. The VID for user 0 did not mach the one in the user table.

This might reflect a bug in the user revision module.

Thanks for this.

mohangupta’s picture                                        

Drupal 8                                        

mohangupta commented 

What is the remedy for Drupal 8?

wizbard’s picture                                        

Where should I insert snippet?                                        

wizbard commented 

I know very little PHP - just enough to be dangerous. I'm specifically trying to get Ubercart working, but after each completed transaction (membership registration), User 0 is re-numbered. Yes, I can go run the query in PHPMyAdmin manually, but in what file should I insert the snippet listed above:

insert into users (name, pass, mail, theme, signature, language, init, timezone) values ('', '', '', '', '', '', '', '');
update users set uid = 0 where name = '';
                                                       

to restore User 0 after each new transaction? I'm using Drupal 7.

Many thanks for all the help I've received from these forums!

-wiz

goose2000’s picture                                        

Update D 6.32                                        

goose2000 commented 

I just updated to Drupal 6.32 and this seems to have broke Drush now. I'm getting this error now.

svetlio’s picture                                        

You have uid0 and have this                                        

svetlio commented 

You have uid0 and have this err?
(MYSQL related)

1. export your db_name.
2. drop your db_name.
3. create db_name with utf8 charset.
CREATE DATABASE `mydb` CHARACTER SET utf8 COLLATE utf8_general_ci;
4. import your db.

wizbard’s picture                                            

You have uid0 and have this                                            

wizbard commented 

Thank you, svetlio. I just saw this response from you and will try it. But before I do (since I just crashed another site of mine because of a different problem relating to dropping the database) let me just confirm that you are basically just telling me to delete and then recreate the database (after backing it up) using the utf8 charset. Correct? Sorry, I just want to do it right the first time.

Thanks,

-wiz

svetlio’s picture                                                

That's right                                                

svetlio commented 

That's right

One note from my experience:
One of my installation this was good effect, for another not. So this is not the 100% for all situations solution. But sometime work ;)

Wouter Waeytens’s picture                                            

Worked for me!                                            

Wouter Waeytens commented 

Worked for me thanks a lot! Saved me a lot of time :)

JurgenR’s picture                                        

Login as user 1                                        

JurgenR commented 

Drupal backend developer since 2011.
Open Source Webdevelopment Coding Blog                                                

sujann143’s picture                                        

Missing uid gave me serious error                                        

sujann143 commented 

I didnt realize about it but while i was using Quiz module, i was not able to proceed to next question after i click next. I did mysql import on my local and while i went to do drush cc, it gave me message of missing uid 0 and that's how i realised the issue with it.

mariocantor’s picture                                        

remove some fields                                        

mariocantor commented 

In my Drupal 7 the SQL command did not worked, so I removed fields (mode`, `sort`, `threshold`) and their values. and the query worked perfectly.

divined’s picture                                        

Why its happens?                                        

divined commented 

Most value question: Why its happens?

Why UID 0 is removed from the database once a month?

drugan’s picture                                        

Drupal Core files may be hacked                                        

drugan commented 

This is what happened with my drupal 8. Making some developing I've accidentally commented out a line of drupal core code and after refreshing a page everything was gone away. Nothing on the page, even bartik theme had disappeared, just black footer background and this message: You are not authorized to access this page..

I've tryed to go to <DrupalRoot>/user but mod_rewrite changed it for <DrupalRoot>/user/1 which is expected because I was logged in at the moment as the user 1. Then I've tryed this <DrupalRoot>/user/login, that gave me a bare html form to insert name and password but again, no avail.

Sorry, unrecognized username or password. Have you forgotten your password?                                                        

Go further, I've tryed drush cc all. This gave "Could not login with user ID #0."which lead me on this thread. Checked database user tables, everything is OK. Tryed reinstall site, deleting settings.php at first. Nothing helped — "Drupal site is already installed, go to main page".

What is saved me is git reset HEAD. After resetting working directory my site again worked perfectly. The internal reason for this kind of crashes is that Drupal always has at any its run time at least two users. One is you, as the Drupal site user, may be authenticated or anonymous, and the other user with uid == 1, which is the Drupal itself! It works for you on the backgroung, executing scripts and serving pages. You may ask but how about physical user with uid == 1, who is s/he? To understand this you need to recall about Linux superuser, which works on the background even if it is not created(!), and you as administrator, installing for example software on the system on behalf of a superuser using sudo <command>. That is, when we logged in the User One, we are actually an ordinary user having the same permissions as the great and mighty Drupal :)

drupalinthailand’s picture                                        

Thank you so much ! BUT...                                        

drupalinthailand commented 

Thank you so much, I have an anonymous user but this anonymous user does not have a login record, so it is still not recognized by drupal, do you know what I can do ?

I compared with other users, even on other drupal sites, and the only difference is the LOGIN column in the users table that is set to zero only on 1 websites having issues with anonymous user.

Any idea about how I could fill this login column ?

Thanks again.

rooby’s picture                                            

Anonymous users aren't logged in                                            

rooby commented 

By definition, an anonymous user is a not logged in user. The anonymous user will never be logged in so it is normal that the login timestamp be zero for the anonymous user (uid = 0).

Also, any user having a login value of zero will not break anything, so if you are having problems that isn't the cause.

drupalinthailand’s picture                                                

Sorry but this is wrong                                                

drupalinthailand commented 

Sorry but this is wrong, all my websites anonymous users have a login value that is not 0

Only 1 website that has problem and anonymous user with 0 in login column

nevets’s picture                                                    

I just checked a test site                                                    

nevets commented 

I just checked a test site (Drupal 7) and for user 0, most columns/fields are 0 or null, including login being 0.

drupalinthailand’s picture                                                        

sorry i am on drupal 6                                                        

drupalinthailand commented 

sorry i am on drupal 6

rooby’s picture                                                    

zero is ok                                                    

rooby commented 

As you can see from the Drupal 6 example above for adding the anonymous user to the database, it is ok to have zero for the login column, even in D6.

I suspect that whatever your problem is is not related to the anonymous user login value being zero.

Also, extended conversations relating to bug troubleshooting are not really on topic for comments on documentation.

I would recommend posting a question asking for help fixing whatever your problem is.
Include as much detail as possible about what the symptoms of the problem are. So far you have said you have a problem but not said what it is.

I recommend posting it either to http://drupal.stackexchange.com/ or https://www.drupal.org/forum/22                                                                    

harivenuv’s picture                                        

Drupal 8                                        

harivenuv commented 

drush -u 1 sql-query "INSERT INTO users (uid, langcode, uuid) VALUES (0, "en", "");" this is not working the below is working

drush -u 1 sql-query "INSERT INTO `users_field_data` (`uid`, `langcode`, `preferred_langcode`, `preferred_admin_langcode`, `name`, `pass`, `mail`, `timezone`, `status`, `created`, `changed`, `access`, `login`, `init`, `default_langcode`) VALUES ('0', 'en', 'en', NULL, '', NULL, NULL, 'UTC', '0', '', '', '0', '0', NULL, '1');"

                                       

来自   https://www.drupal.org/node/1029506                                        


                                       

“无法使用用户ID#0登录”                                            

在D7上,我刚刚从D6升级,我尝试了每次drush命令时“无法使用用户ID#0登录”。                                                                                            

只有我做过的古怪的事情是:                                                                                            

- 将免费更新设置为true 
- 将数据库移至新下载的7并编辑settings.php而不是移动文件                                                                                            

评论                                                                            

joachim的头像                                                                                

评论#1                                                                                    

joachim 信用归因: joachim评论道                                                                                    
项目:                                                                                                            杰韦利                                                                                                            »匆匆                                                                                                            
零件:                                                                                                            devel的                                                                                                            »基础系统(内部API)                                                                                                            

对不起,错误的模块!                                                                                                

moshe weitzman的头像                                                                                

评论#2                                                                                    

moshe weitzman 信用归因: moshe weitzman评论道                                                                                    
状态:                                                                                                            活性                                                                                                            »推迟(维护者需要更多信息)                                                                                                            

您的用户表中是否缺少uid = 0?                                                                                                

joachim的头像                                                                                

评论#3                                                                                    

joachim 信用归因: joachim评论道                                                                                    

的确是!                                                                                                

它在数据库预升级中存在。这是一个已知的核心bug吗?                                                                                                

moshe weitzman的头像                                                                                

评论#4                                                                                    

moshe weitzman 信用归因: moshe weitzman评论道                                                                                    
类别:                                                                                                            窃听器                                                                                                            »支持                                                                                                            
优先:                                                                                                            危急                                                                                                            »正常                                                                                                            
状态:                                                                                                            推迟(维护者需要更多信息)                                                                                                            »关闭(按设计工作)                                                                                                            

http://drupal.org/node/924026http://drupal.org/node/511690                                                                                                

joachim的头像                                                                                

评论#5                                                                                    

joachim 信用归因: joachim评论道                                                                                    

怀疑它是VBO - 这是一个全新的D6我安装测试图像模块升级,当然不会去用户桌附近!                                                                                                


                                                                                               


                                                                                               

来自  https://www.drupal.org/project/drush/issues/1028700                                                                                                


                                                                                               


                                                                                               


                                                                                               


                                                                                               

Could not login with user ID

Trying out Drush, getting the error above on certain copies of sites. Googled but could not find reference to this error. Hoping someone might be able to give me some insights here. Probably something simple that I don't yet understand about the utility. Thanks!

CommentFileSizeAuthor
#19                                                                                                                                                                drush-missing-user-0-help.patch                                                                                                                                                                1.04 KBwebchick                                                                                                                                                                
Members fund testing for the Drupal project.Drupal AssociationLearn more                                                                                                                                    

Comments

sittard’s picture                                                                                                                                        

Comment#1                                                                                                                                            

sittard CreditAttribution: sittard commented 

Got the same error message as well! I've blocked anonymous user access to my site. Using the command drush -u 1 status works for me. The -u option specifies a user id to log in with.

moshe weitzman’s picture                                                                                                                                        

Comment#2                                                                                                                                            

moshe weitzman CreditAttribution: moshe weitzman commented 
Status:Active» Closed (works as designed)
shrop’s picture                                                                                                                                        

Comment#3                                                                                                                                            

shrop CreditAttribution: shrop commented 

This tip also worked for me on a site where I was receiving the same message. I am cool if it is by design, but am curious as to what permissions trigger Drush to not be able to login as the anonymous user. Most of my sites are multisites so I am also using --uri=http://www.example.com in my Drush command strings.

Sheldon Rampton’s picture                                                                                                                                        

Comment#4                                                                                                                                            

Sheldon Rampton CreditAttribution: Sheldon Rampton commented 

I'm also getting this error message when I run drush to install modules using drush.php dl admin_menu. The download seems to work, despite the error message. When I add the -u 1 option, the "Could not login" error message disappears, and instead I get "Notice: Trying to get property of non-object in /mysitepath/includes/common.inc on line 1797."

I guess this isn't stopping me from getting work done, but it's confusing, and when I get an error message like this, I'd like to know what it means.

Guaka OK’s picture                                                                                                                                        

Comment#5                                                                                                                                            

Guaka OK CreditAttribution: Guaka OK commented 

I'm trying to work with a profile from themesnap (www.themesnap.com/premium-drupal-themes/magazine-plus.html - it's a darn shame the CSS is not GPL).

Now I'm trying to use Drush on a site I've set up with this theme, but I'm getting:

$ drush --verbose=2 info
Initialized Drupal 6.14 root directory at /var/www/example.org/htdocs/                                                                            [notice]
Initialized Drupal site default at sites/default                                                                                                       [notice]
Could not login with user ID #<em>0</em>.                                                                                                           [error]
Command info needs a higher bootstrap level to run - you will need invoke drush from a more functional Drupal environment to run this command.      [error]
The command 'drush.php info' could not be executed.                                                                                                 [error]


$ drush -u 1 --verbose=2 info
Initialized Drupal 6.14 root directory at /var/www/example.org/htdocs                                                                            [notice]
Initialized Drupal site default at sites/default                                                                                                       [notice]
Including version specific file : /opt/drush/commands/pm/update_info/drupal_6.inc                                                                      [notice]
No information available.                                                                                                                           [error]
An error occurred at function : drush_pm_info                                                                                                       [error]
Command dispatch complete                                              

                                                                                                                                                       

And I'm curious about ways that would allow me to use Drush on this site.

Guaka OK’s picture                                                                                                                                        

Comment#6                                                                                                                                            

Guaka OK CreditAttribution: Guaka OK commented 

drush -u 1 status is working now, just like most other drush stuff, drush -u 1 infois not.

It could be nice to have the user ID in the configuration somewhere.

mrfelton’s picture                                                                                                                                        

Comment#7                                                                                                                                            

mrfelton CreditAttribution: mrfelton commented 

drush -u 1 status does get me the status, but I also get the following error at the end:
An error occurred at function : drush_core_status                                                                                                                                                        

fenstrat’s picture                                                                                                                                        

Comment#8                                                                                                                                            

fenstrat CreditAttribution: fenstrat commented 

Just a note for anyone else who comes across this based on the anon user error, i.e. Could not login with user ID #0.

It means exactly what it says so check the user table and ensure there is a user with uid 0.

In my case there was no uid 0 due to a restored faulty backup (where the first entry in the user table, i.e. the anon user, was allocated a uid which was not 0).

rsvelko’s picture                                                                                                                                        

Comment#9                                                                                                                                            

rsvelko CreditAttribution: rsvelko commented 

Thanks to #8 I did export import of the missing row and voala:

(The SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; ensures that the uid will be = 0 and not the last_uid + 1).

Correct the PREFIX before executing.

This stopped the drush errors.

-- phpMyAdmin SQL Dump
-- version 3.2.5
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jan 30, 2010 at 06:55 PM
-- Server version: 5.1.41
-- PHP Version: 5.2.11-2

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

--
-- Database: `dr_akh_cons_at`
--

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

--
-- Dumping data for table `dr6_umed_users`
--

INSERT INTO `PREFIX_users` (`uid`, `name`, `pass`, `mail`, `mode`, `sort`, `threshold`, `theme`, `signature`, `created`, `access`, `login`, `status`, `timezone`, `language`, `picture`, `init`, `data`, `signature_format`) VALUES
(0, '', '', '', 0, 0, 0, '', '', 0, 0, 0, 0, NULL, '', '', '', NULL, 1);

                                                                                                                                                   
citronica’s picture                                                                                                                                        

Comment#10                                                                                                                                            

citronica CreditAttribution: citronica commented 

Thanks for this. Oddly enough, I had this problem on a fresh install in which I'd never monkeyed with the database at all. For no obvious reason, there was no uid 0 -- the anonymous user was uid 3 (?). I just changed it in the database to 0 and the drush error is now gone.

Sutharsan’s picture                                                                                                                                        

Comment#11                                                                                                                                            

Sutharsan CreditAttribution: Sutharsan commented 

I get this error because the site I work on uses a settings.php in /sites/example.comand has no settings.php in /sites/default. Using -l http://localhost/example.comdoes not help either. Only the -u 1 gets me through without errors.

jwilson3’s picture                                                                                                                                        

Comment#12                                                                                                                                            

jwilson3 CreditAttribution: jwilson3 commented 

This will happen if you reload a site from a dumpfile created by drush sql-dump; the uid of UserZero (the anonymous user) can get set to 1+number of users.

Assuming you're using drush you can do the following to fix it (YMMV):

 echo "update users set uid=0 where name='' and pass='' and data is NULL" | `drush sql-connect`
                                                                                                                                                       

NOTE: your mileage may vary, update the stuff in between the back-ticks if you need to specify something else (eg --uri=example.com) to get to the correct mysql connection string.

protoplasm’s picture                                                                                                                                        

Comment#13                                                                                                                                            

protoplasm CreditAttribution: protoplasm commented 

My 1+number of users occurred without the sql-dump on migrating the database. But the same concept in #12 worked for me. I just edited the UID of that entry directly to 0 and everything was normal again. You have to give drush props for the clue to the problem via the error message.

jghyde’s picture                                                                                                                                        

Comment#14                                                                                                                                            

jghyde CreditAttribution: jghyde commented 

Combo of #9 first & then #12 worked for me. Excellent!

Joe
http://www.hydeinteractive.com/                                                                                                                                                        

roball’s picture                                                                                                                                        

Comment#15                                                                                                                                            

roball CreditAttribution: roball commented 
Version:All-Versions-2.0» All-versions-3.3

Adding

$options['u'] = '1';
                                                                                                                                                       

to "drushrc.php" residing in drush's install dir solves all these weird problems.

Sivaji’s picture                                                                                                                                        

Comment#16                                                                                                                                            

Sivaji CreditAttribution: Sivaji commented 

In recent version drushrc.php is no longer available instead you need to change includes/environment.inc line 902

$drush_user = drush_set_context('DRUSH_USER', drush_get_option(array('u', 'user'), 0));                                                                                                                                                        

to

$drush_user = drush_set_context('DRUSH_USER', drush_get_option(array('u', 'user'), 1));                                                                                                                                                        

roball’s picture                                                                                                                                        

Comment#17                                                                                                                                            

roball CreditAttribution: roball commented 

The shipped file is called "example.drushrc.php" and it *is* there in both versions 3.3 (v 1.8 2010/06/05) and 4.0-rc1 (v 1.13 2010/12/05). Why should it have been removed?

pog21’s picture                                                                                                                                        

Comment#18                                                                                                                                            

pog21 CreditAttribution: pog21 commented 

Thanks #8 for a clear explanation. I had this problem upon installing with fantastico. Used phpmyadmin to look at users table, which showed an entry right before user 1 with blank fields, but id of 3. Manually changed this to 0 and now it's working.

webchick’s picture                                                                                                                                        

Comment#19                                                                                                                                            

webchick CreditAttribution: webchick commented 
Status:Closed (works as designed)» Needs review
FileSize
drush-missing-user-0-help.patch                                                                                                                                                                    1.04 KB

This patch might help reduce duplicate support requests about this. I was stranded and had no idea what was causing this until I googled.

Feel free to mark it back to "by design," though. Not sure how much special casing you really want to put into Drush for a 6.x-era bug caused by faulty database dumping tools.

webchick’s picture                                                                                                                                        

Comment#20                                                                                                                                            

webchick CreditAttribution: webchick commented 
Version:All-versions-3.3»
moshe weitzman’s picture                                                                                                                                        

Comment#21                                                                                                                                            

moshe weitzman CreditAttribution: moshe weitzman commented 
Status:Needs review» Fixed

comitted. thanks.

Comment#22                                                                                                                                            

Status:Fixed» Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

chx’s picture                                                                                                                                        

Comment#23                                                                                                                                            

chx CreditAttribution: chx commented 
Category:support» task
Status:Closed (fixed)» Active

This is a weak solution. Ask the user "Do you want to fix this?". Here's how: name and mail both are unique and so if there is a user whose name and mail are empty that's the anon user, run UPDATE uid = uid - uid WHERE name = '' AND mail = '' and hope for the best

roball’s picture                                                                                                                                        

Comment#24                                                                                                                                            

roball CreditAttribution: roball commented 

Why not just defaulting $options['u'] to '1'?

moshe weitzman’s picture                                                                                                                                        

Comment#25                                                                                                                                            

moshe weitzman CreditAttribution: moshe weitzman commented 
Status:Active» Closed (fixed)

I'm fine leaving it as docs only.

wizonesolutions’s picture                                                                                                                                        

Comment#26                                                                                                                                            

wizonesolutions CreditAttribution: wizonesolutions commented 

Thanks #8! Worked for me.

EvanDonovan’s picture                                                                                                                                        

Comment#27                                                                                                                                            

EvanDonovan CreditAttribution: EvanDonovan commented 
Version:
» All-versions-4.x-dev
Issue summary:View changes                                                                                                                                                                    

Here is the insert SQL that you want for 7.x:

INSERT INTO `users` (`uid`, `name`, `pass`, `mail`, `theme`, `signature`, `signature_format`, `created`, `access`, `login`, `status`, `timezone`, `language`, `picture`, `init`, `data`) VALUES
(0, '', '', '', '', '', NULL, 0, 0, 0, 1, NULL, '', 0, '', NULL)
                                                                                                                                                   
hectorplus’s picture                                                                                                                                        

Comment#28                                                                                                                                            

hectorplus CreditAttribution: hectorplus commented 

#27, work for me, running Drupal 7.x

Thanks


                                                                                                                                                       

来自  https://www.drupal.org/project/drush/issues/511690                                                                                                                                                        


                                                                                               


                                       


普通分类: