reset – TecAdmin https://tecadmin.net How to guide for System Administrator's and Developers Wed, 03 Nov 2021 02:57:26 +0000 en-US hourly 1 https://wordpress.org/?v=6.1.1 How to Git Reset to Head https://tecadmin.net/git-reset-head/ https://tecadmin.net/git-reset-head/#respond Wed, 03 Nov 2021 02:57:07 +0000 https://tecadmin.net/?p=28303 Git reset is a process that is pretty similar to undoing the recent Git commit that we covered in one of the previous tutorials. However, in this one, we will cover Git reset to Head in more depth. We will check what the revert command does and what is mixed reset. Read on and find [...]

The post How to Git Reset to Head appeared first on TecAdmin.

]]>
Git reset is a process that is pretty similar to undoing the recent Git commit that we covered in one of the previous tutorials. However, in this one, we will cover Git reset to Head in more depth. We will check what the revert command does and what is mixed reset. Read on and find some tips and tricks about Git reset.

Reset Last Git Commit to HEAD

In our previous article, we used git reset –soft HEAD~1 to undo the last commit without losing changes that were uncommitted. Additionally, we used git reset –hard HEAD~1 to undo everything, even changes that we made locally. But what to do when you want to reset the last Git commit to HEAD, keep the changes that you did in your repo directory, but you don’t want to keep them in the index? Here’s your answer.

If you stumble upon situations like the one that we described above, you have to use –mixed flag. Here’s an example.

Let’s say that we added some sort of file with our last commit.

git log --oneline --graph 
Output:
d445900 (HEAD -> master) Added a new file named "test_file" 61t6ll5 Second commit 4096r12 Initial repository commit

Now let’s run Git reset command with --mixed flag.

git reset --mixed HEAD~1 

What the command above did is the following. It removed the last commit, which in this case was file addition and it removed it from the Git Index, but the file remained in the directory where you are currently located ( which is your local repository directory ). So flag --mixed is actually a combination of --soft and --hard Git reset options. That is why it’s called mixed in the end.

How to Use Git Revert Option to Reset

Revert is a bit different than reset. The main difference is that reset sets a new position for HEAD while revert actually reverts the whole commit which is specified. Let us show you an example of how this actually works.

git log --oneline --graph 
Output:
d445900 (HEAD -> master) Added a new file named "test_file" 61t6ll5 Second commit 4096r12 Initial repository commit

So again, the last thing that we committed was file addition. Let’s run the revert command now.

git revert HEAD 

Your default text editor will open now and the output will look like this.

Revert “Added a new file named test_file”

This reverts commit 5e998t74du5h4z4f.

# Please enter the commit message for your changes. Lines starting
# with ‘#’ will be ignored, and an empty message aborts the commit.
#
# On branch master
# Your branch is ahead of ‘origin/master’ by 6 commits.
#    (use “git push” to publish your loacl commits)
#
# Changes to be committed:
#                deleted:         test_file
#

Once you are done, exit the text editor, and a new message will pop up.

Output:
[master d445900] Revert "Added a new file named test_file" 1 file changed, 1 deletion(-) delete mode 100644 test_file

That’s it! You successfully competed Git reset to HEAD action with the revert option.

The post How to Git Reset to Head appeared first on TecAdmin.

]]>
https://tecadmin.net/git-reset-head/feed/ 0
Reset WordPress Admin Password via SQL or phpMyAdmin https://tecadmin.net/reset-wordpress-admin-password/ https://tecadmin.net/reset-wordpress-admin-password/#respond Sun, 05 Nov 2017 09:36:43 +0000 https://tecadmin.net/?p=14080 Question – How to reset WordPress admin password via SQL query? How to reset WordPress admin password using phpMyAdmin? How to Reset WordPress forgotten password with SQL query? How to find WordPress default admin password? If you have forgotten your SugarCRM admin password or due to any reason, you are not able to login to [...]

The post Reset WordPress Admin Password via SQL or phpMyAdmin appeared first on TecAdmin.

]]>
Question – How to reset WordPress admin password via SQL query? How to reset WordPress admin password using phpMyAdmin? How to Reset WordPress forgotten password with SQL query? How to find WordPress default admin password?

If you have forgotten your SugarCRM admin password or due to any reason, you are not able to login to SugarCRM with admin user. You can simply check the active admin user using SQL query and reset the password with simple SQL query.

Reset WordPress Admin Password via SQL

The first query will fetch show the details of the administrator account based on username.

SELECT * FROM wp_users WHERE user_login = 'admin';

If you only have the email address of admin user. Search user details using the command.

SELECT * FROM wp_users WHERE user_email = 'admin@example.com';

WordPress uses md5 encrypted passwords. The query will change the password for the specified username. You must change new_password with your password and ID with the got ID from above queries.

UPDATE wp_users SET user_pass = md5('new_password') WHERE ID = 1;

Reset WordPress Admin Password via phpMyAdmin

You can also connect WordPress database with phpMyAdmin and reset the admin password. Open table wp_users and edit the record of the admin user. Now under the user_pass column, select the MD5 in functions and put plain text password in value section and save it.

Reset WordPress Admin Password

The post Reset WordPress Admin Password via SQL or phpMyAdmin appeared first on TecAdmin.

]]>
https://tecadmin.net/reset-wordpress-admin-password/feed/ 0
How to Reset Admin Password on Ubuntu https://tecadmin.net/reset-admin-user-password-on-ubuntu/ https://tecadmin.net/reset-admin-user-password-on-ubuntu/#comments Wed, 11 Mar 2015 08:16:00 +0000 https://tecadmin.net/?p=7432 When you install Ubuntu on your system. The first user you have created get administrative privileges along with root account. You can also create administrative user latest installation of Ubuntu using main account. In some case if you lost your administrative account access on Ubuntu, you can reset it within 2 minutes. I am running [...]

The post How to Reset Admin Password on Ubuntu appeared first on TecAdmin.

]]>
When you install Ubuntu on your system. The first user you have created get administrative privileges along with root account. You can also create administrative user latest installation of Ubuntu using main account.

In some case if you lost your administrative account access on Ubuntu, you can reset it within 2 minutes. I am running Ubuntu 14.10 on Virtual Box. Follow below steps to reset password.

  • 1. Restart you Ubuntu system.
  • 2. On Grub loading screen press ESC to view list.
  • 3. Now select “Advanced options for Ubuntu” and press enter.
    ubuntu-password-reset-1
  • 4. Now select following (recovery mod) option and press enter.
    ubuntu-password-reset-2
  • 5. Here you will see Recovery menu. Select “Drop to root shell prompt”.
    ubuntu-password-reset-3
  • 6. Change password of your administrative user. For this example, I am changing password of user “root”
     root@ubuntu:~# passwd root
    
  • 7. In case you get error like below.
    passwd: Authentication token manipulation error
    passwd: password unchanged
    

    remount your file system in read/write mode using following command and try reset password again.

    root@ubuntu:~# mount -o remount,rw /
    

    ubuntu-password-reset-4

  • The post How to Reset Admin Password on Ubuntu appeared first on TecAdmin.

    ]]> https://tecadmin.net/reset-admin-user-password-on-ubuntu/feed/ 6 How to Reset MySQL root Password in Linux https://tecadmin.net/how-to-recover-mysql-root-password/ https://tecadmin.net/how-to-recover-mysql-root-password/#comments Mon, 18 Feb 2013 10:07:36 +0000 https://tecadmin.net/?p=150 Q. How to reset MySQL root password in Linux? How do I recover MySQL root password? I forgot MySQL root password, steps to change MySQL root password? How to reset MySQL root password using the command line. How to reset forgotten MySQL root password on Linux? How to reset MySQL 5.7 root password? MySQL is [...]

    The post How to Reset MySQL root Password in Linux appeared first on TecAdmin.

    ]]>
    Q. How to reset MySQL root password in Linux? How do I recover MySQL root password? I forgot MySQL root password, steps to change MySQL root password? How to reset MySQL root password using the command line. How to reset forgotten MySQL root password on Linux? How to reset MySQL 5.7 root password?

    MySQL is an open source database software widely used for data storage. Sometimes we forgot MySQL root password. So don’t be panic, This tutorial will help you to reset MySQL root password with simple steps.

    Reset MySQL Root Password

    1. Start MySQL in Safemode – First of all, you are required to stop running MySQL server. Use one of the following commands to stop MySQL server on your Linux system.
      systemctl stop mysql.service 
      
    2. Start MySQL in safe mode – Now start MySQL server in safe mode using withe the --skip-grant-tables option. Use the following command to start MySQL in safe mode. In safe mode, MySQL does not prompt for login password.
      mysqld_safe --skip-grant-tables & 
      
    3. Reset MySQL root Password – Next, login to MySQL server as root user and change password using the following set of commands. This will reset MySQL root password on your system.

      For MySQL 5.6 or Below

      mysql -u root 
      
      mysql> USE mysql;
      mysql> UPDATE user SET password=PASSWORD("NEW-PASSWORD") WHERE User='root';
      mysql> FLUSH PRIVILEGES;
      mysql> quit
      

      For MySQL 5.7 or Above

      mysql -u root 
      
      mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD("NEW-PASSWORD");
      mysql> FLUSH PRIVILEGES;
      mysql> quit
      
    4. Restart MySQL Service – Once you change the password. Terminate the current mysqld process, and then start it again as regular service.
      sudo pkill mysqld && sudo pkill mysqld_safe 
      systemctl start mysql.service 
      

    Verify New Password

    After resetting MySQL root account password and restarting, just verify new password by login.

    mysql -u root -p 
    
    
    Enter password: **********
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1308
    Server version: 5.7.33-0ubuntu0.16.04.1 (Ubuntu)
    
    Copyright (c) 2000, 2021, Oracle and/or its affiliates.
    
    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>
    

    Verify New Password

    The post How to Reset MySQL root Password in Linux appeared first on TecAdmin.

    ]]>
    https://tecadmin.net/how-to-recover-mysql-root-password/feed/ 2