Gitlab忘记root用户密码解决办法
一、Gitlab忘记root用户密码,重置用户密码和查看用户ID号方法
1、Gitlab查看用户id号的方法
1)方法1:通过api接口查询
接口查询地址:http://gitlab的url/api/v4/users?username=用户名
比如查看gitlab的root用户id
在浏览器页面里直接访问"http://172.16.60.237/api/v4/users?username=root"
或者
在linux终端命令行里直接通过curl命令进行访问
[root@localhost ~]# curl http://172.16.60.237/api/v4/users?username=root
[{"id":1,"name":"Administrator","username":"root","state":"active","avatar_url":"https://www.gravatar.com/avatar/e64c7d89f26bd1972efa854d13d7dd61?s=80\u0026d=identicon","web_url":"http://gitlab.example.com/root"}]
2)方法2:进入gitlab数据库查询
[root@localhost ~]# gitlab-rails dbconsole
psql (10.9)
Type "help" for help. gitlabhq_production=> \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
---------------------+-------------+----------+-------------+-------------+---------------------------------
gitlabhq_production | gitlab | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
postgres | gitlab-psql | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | gitlab-psql | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/"gitlab-psql" +
| | | | | "gitlab-psql"=CTc/"gitlab-psql"
template1 | gitlab-psql | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/"gitlab-psql" +
| | | | | "gitlab-psql"=CTc/"gitlab-psql"
(4 rows) ## 连接数据库
gitlabhq_production=> \c gitlabhq_production
You are now connected to database "gitlabhq_production" as user "gitlab".
gitlabhq_production=> select id,name,username from users;
id | name | username
----+---------------+----------
1 | Administrator | root
(1 row)
## 查找账户id
gitlabhq_production=> select id from users where username = 'root';
id
----
1
(1 row) ==============================================================================================
2、忘记Gitlab的root用户密码的重置方法
如果忘记了Gitlab的root用户密码,则可以在服务器上面直接修改数据:
[root@localhost ~]# gitlab-rails console production #然后以此执行下面命令(需要提前查询用户的id号)
...> user = User.where(id: 1).first
...> user.password = 'secret_pass'
...> user.password_confirmation = 'secret_pass'
...> user.save!
例如重置root用户密码为root@123,root用户id为1
[root@localhost ~]# gitlab-rails console production
DEPRECATION WARNING: Passing the environment's name as a regular argument is deprecated and will be removed in the next Rails version. Please, use the -eoption instead. (called from require at bin/rails:4)
--------------------------------------------------------------------------------
GitLab: 12.2.0 (1c1d47c5974)
GitLab Shell: 9.3.0
PostgreSQL: 10.9
--------------------------------------------------------------------------------
Loading production environment (Rails 5.2.3)
irb(main):001:0> user = User.where(id: 1).first
=> #<User id:1 @root>
irb(main):002:0> user.password = 'root@123'
=> "root@123"
irb(main):003:0> user.password_confirmation = 'root@123'
=> "root@123"
irb(main):004:0> user.save!
Enqueued ActionMailer::DeliveryJob (Job ID: e562694d-2a1b-4bad-843b-d8567ac51077) to Sidekiq(mailers) with arguments: "DeviseMailer", "password_change", "deliver_now", #<GlobalID:0x00007fae7e55bcc8 @uri=#<URI::GID gid://gitlab/User/1>>
=> true
irb(main):005:0> quit

-----------------------------------------------------------书山有路勤为径,学海无涯苦作舟-------------------------------------------------------------
Gitlab忘记root用户密码解决办法的更多相关文章
- CentOS忘记普通用户密码解决办法
普通用户忘记密码 1.使用root用户登录系统,找到/etc/shadow文件. 2.找到用户名开头的那一行,例如我的用户名为pds,,以冒号为分割符,红色部分是密码加密部分 pds:$1$Civop ...
- GitLab修改root用户密码
GitLab是一个私有的Git仓库,具有较好的项目管理和用户管理能力.对于普通用户而言,通过系统的重置密码,接受邮件即可解决,可是GitLab的管理员账号,缺省的邮箱是一个不存在的邮箱地址,所以没有办 ...
- mysql忘记帐号密码 解决办法
首先关闭mysql 使用命令行启动mysql(一般要找到mysql.ini文件) 在windows上mysql.ini文件可以通过查看当前mysql进程参数查看到,具体方法点此 在启动mysql命令行 ...
- Linux 忘记root登录密码解决方法
很多朋友经常会忘记Linux系统的root密码,linux系统忘记root密码的情况该怎么办呢?重新安装系统吗?当然不用!进入单用户模式更改一下root密码即可. 步骤如下: 重启linux系统 3 ...
- MySQL忘记root用户密码修改方法
一般来说在MySQL修改用户密码有好几种方法: 1.修改自己的密码可用: set password=password('123456'); 2.修改其它用户的密码可用: set password fo ...
- Linux忘记root登录密码解决方法
有时候由于长时间米有登录linux系统,等需要用的时候突然忘记root密码,怎么办?下面简单介绍解决方法. redhat 和 centos 6.5 可以,7.0以上未测 在系统重启后,不停地按”e”键 ...
- CentOS忘记用户名或者密码解决办法
方法一:如果用户名和密码都忘记了,可以用以下这个方法找回:(和第二种大步骤差不多,需注意3,4步) 1. 在出现grub画面时,用上下键选中你平时启动linux的那一项,然后按e键 2. 再次用上下键 ...
- mysql忘记root用户密码找回步骤
修改或找回root密码步骤1.修改MySQL的登录设置: # vi /etc/my.cnf 在[mysqld]的段中加上一句:skip-grant-tables 保存并且退出vi. 2.重新启动mys ...
- 利用lnmp一键安装的php环境忘记mysql,root用户密码解决方法
1.cd /lnmp1.5/tools/ 2.sh reset_mysql_root_password.sh 这样,即可完成修改!
随机推荐
- ctfhub技能树—密码口令—弱口令
什么是弱口令? "弱口令(weak password) 没有严格和准确的定义,通常认为容易被别人(他们有可能对你很了解)猜测到或被破解工具破解的口令均为弱口令. 弱口令指的是仅包含简单数字和 ...
- ctfhub技能树—信息泄露—备份文件下载—.DS_Store
打开靶机 查看页面信息 使用dirsearch进行扫描 访问该网页,下载文件 使用Linux系统打开文件 发现一个特殊文件,使用浏览器打开 拿到flag 二.使用Python-dsstore工具查看该 ...
- oracle_fdw的安装和使用
1.下载instant oracle client 下载网址:https://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html ...
- Centos7下安装MySQL8.0.23-小白的开始
首先简单介绍一下什么叫MySQL: 数据库简而言之就是存储数据的仓库,为了方便数据的存储和管理,它将数据按照特定的规律存储在磁盘上.是为了实现一定的目的,按照某种规则组织起来的数据的集合: MySQL ...
- Q-Q图原理详解及Python实现
[导读]在之前的<数据挖掘概念与技术 第2章>的文章中我们介绍了Q-Q图的概念,并且通过调用现成的python函数, 画出了Q-Q图, 验证了Q-Q图的两个主要作用,1. 检验一列数据是否 ...
- 手机QQ空间自动点赞登录
学以致用~使用 Appium 模拟人类操控手机行为 V2.0在手机上运行,目前实现以下功能: 1.小黑屋模式,一分钟内给好友发100条消息然后进了好友的小黑屋 2.定时发消息提醒对象多喝热水~ 3.对 ...
- 微信小程序 发送模板消息的功能实现
背景 - 小程序开发的过程中,绝大多数会满足微信支付 - 那么,作为友好交互的体现,自然就会考虑到支付后的消息通知咯 - 所以,我的小程序项目也要求完成这个效果,so.分享一下自己的实现步骤,以方便道 ...
- Manachar’s Algorithm
Manachar's Algorithm Longest palindromic substring - Wikipedia https://en.wikipedia.org/wiki/Longes ...
- Page not found (404) 不被Django的exception中间件捕捉 中间件
Using the URLconf defined in config.urls, Django tried these URL patterns, in this order:
- Redis 学习笔记系列文章之 Redis 的安装与配置 (一)
1. 介绍 Redis is an open source (BSD licensed), in-memory data structure store, used as database, cach ...