Config inc php пароль root

How to Set MySQL Root Password using phpMyAdmin

Do you want to change a password for the root account of your MySQL server? Sometimes you may want to set a password for the ‘root’@’localhost’ account. In this article, I show you 3 possible ways to reset the password for your root account.

When your application is live, you have to pass both username and password in order to access the database. For accessing phpMyAdmin on a live server, your hosting does set the credentials for you. But on the local server, you have to set credentials yourself. Though users rarely set the password on the local machine to access phpMyadmin, it’s always a good practice to do so.

That being said, let’s take a look at how to set MySQL Root password. I am going to show you 3 different ways of resetting the password.

Читайте также:  Life in lambda python

How to Set Root Password in phpMyAdmin

phpMyAdmin is a fantastic software built for handling your MySQL databases. It just makes developers life easy to manage the database, tables, table structures, queries, and so on.

Using phpMyAdmin, one can set the Root password in a few steps.

Go to the phpMyAdmin on the browser. Most probably you can access it using http://localhost/phpmyadmin .

Click on the ‘User Accounts’ from the top bar.

User Accounts

You will then see a list of user accounts. We need the last account from the list with the User name as ‘root’ and the Host name as ‘localhost’. Click on the ‘Edit privileges’ from the Action column of this row.

Edit Privileges

On the next screen, click on the ‘Change password’. In the form, enter the password you want to set and click on the ‘Go’.

Change Password

After these steps are done, head over to your editor and open the config.inc.php from the phpmyadmin directory. On my Windows 10 machine, I have XAMPP server installed and config.inc.php path is D:\xampp\phpMyAdmin\config.inc.php . Adjust the path as per your installations.

Search for $cfg[‘Servers’][$i][‘auth_type’] in the file config.inc.php . This variable should have a ‘config’ value set by default. Change this value to ‘cookie’ as follows.

$cfg['Servers'][$i]['auth_type'] = 'cookie';

Run the URL http://localhost/phpmyadmin on the browser and this time you will be asked for entering username and password. Enter the username as ‘root’ and password which you set in the above steps, it will log you inside the phpMyAdmin.

Keep a note you have to use the same username and password in your database connection code for the applications.

This is the most efficient way of changing the Root password. However, there are 2 other ways to set the password for ‘root’@’localhost’ account.

Other Ways to Set MySQL Root Password

If you want to try another way of changing a Root password, then first revert back the changes made in the config.inc.php file.

$cfg['Servers'][$i]['auth_type'] = 'config';

Head over to the phpMyAdmin, click on the ‘SQL’ from the top bar, and run the below query.

SET PASSWORD FOR root@localhost = PASSWORD('PASSWORD_HERE');

Replace the placeholder with the actual value. Set again the ‘cookie’ value for the $cfg[‘Servers’][$i][‘auth_type’] variable of your config.inc.php file and you are done.

The last option to reset the Root password is through the command line. For this, you again need to revert your changes of config.inc.php file.

If you have set the MySQL path in your environment then you can run the MySQL queries directly in the command prompt. If the path is not set, then open the terminal inside the MySQL installation directory. In my case, it’s path is D:\xampp\mysql\bin .

In the terminal, run the below command:

mysqladmin -u root password PASSWORD_HERE

Command Prompt

After this, set the value as ‘cookie’ for the $cfg[‘Servers’][$i][‘auth_type’] variable.

That’s it! I hope you got to know how to set MySQL Root password using phpMyAdmin and terminal. Please share your thoughts and suggestions in the comment section below.

If you liked this article, then please subscribe to our YouTube Channel for video tutorials.

Источник

How to Change Your MySQL Password in XAMPP (3 Methods)

Learn how to change your XAMPP MySQL password.

Staying secure online has never been more important, especially for businesses. Password selection and maintenance both play an essential role in security. Unfortunately, they often get neglected, especially on local installations such as XAMPP.

However, local software can be just as vulnerable to malicious activity, and by default XAMPP typically ships without a root password for the MySQL database. Adding one and changing it regularly can help keep your data secure and prevent the loss of hours of hard work.

In this article, we’ll explain why you might want to change your XAMPP MySQL password. Then we’ll walk you through three different methods you can use. Let’s get started!

Why You Might Want to Change Your MySQL Password

There are several reasons why you might want (or need) to change your MySQL password. First and most important: when you install XAMPP on your computer, the password for the “root” user is left empty. This means that there is no security on this account by default.

The root user is essentially the administrator account—it has unrestricted access to all commands and files in the system. As such, having no password protection for this user is a major security hole. Anyone could log in to the user account and edit files on your local installation.

Apart from that, it’s also a smart security practice to change your passwords periodically. Doing so helps prevent malicious activity, particularly if you use the same password in multiple places. Regularly changing passwords can help offset issues that might arise without this practice.

Finally, you may have simply forgotten your password and, as a result, can’t access files or functions that you need on your local XAMPP WordPress installation. Whatever the reason, being able to change MySQL passwords is a valuable skill that could come in handy.

Info

Looking for a powerful tool for local WordPress development? DevKinsta features one-click site creation, built-in HTTPS, powerful email and database management tools, and more. Learn more about DevKinsta!

How to Change Your MySQL Password in XAMPP (3 Methods)

As with most WordPress tasks, there are multiple ways to change the MySQL password. The method you should use will depend on exactly what you need to do and what interface you’re most comfortable with: the command line, a Graphical User Interface (GUI), or text files. With that in mind, let’s take a look at three ways to change your MySQL password in XAMPP.

1. Change Your MySQL Password Using the XAMPP Shell

Using the XAMPP shell is generally going to be the simplest and quickest method for changing your MySQL password. It does involve using the command line, which can seem daunting at first.

However, it’s actually fairly straightforward. This is also the method you’ll want to use if you’ve forgotten your existing MySQL password and need to reset it.

Note that these commands are the same whether you’re using Windows or macOS. Since this is a unique shell specific to XAMPP, any typical differences between the platforms won’t apply.

To get started, launch your XAMPP Control Panel and click on the Shell button on the right-hand side.

Use the XAMPP shell to change your root password.

This will open up a new window with a command prompt. Enter the following command and press the Enter/Return key:

mysqladmin -u root password 

The shell will prompt you to enter a new password. Press Enter/Return again, and you’ll be asked to confirm the new password.

Once you’ve done that, you’re finished and can close the shell window.

2. Change Your XAMPP MySQL Password via phpMyAdmin

The second method involves using the phpMyAdmin GUI to change your XAMPP MySQL password. This technique is relatively simple, but generally not as quick as the command line method.

First, you need to access the phpMyAdmin interface. Pull up the XAMPP Control Panel and click on Admin in the MySQL row:

Open phpMyAdmin in XAMPP.

PhpMyAdmin will open in a browser window:

The phpMyAdmin interface.

If you’re asked to log in, use the username “root” and enter your root password. If you haven’t set one yet, you can leave it blank.

Next, navigate to the User accounts section in the main menu bar, and locate the root user for localhost in the list:

The root user in phpMyAdmin.

Next, you can click on Edit privileges beside the root user, then select Change password at the top of the page.

Initiate password change in phpMyAdmin.

On the next screen, simply enter the password you want to use:

Change your root password in phpMyAdmin.

When you’re finished, you can click on the Go button in the bottom-right to save the change. That’s it!

3. Change Your XAMPP MySQL Password by Editing the config.inc.php File

If you find yourself in a situation where you know your password is correct, but it isn’t working for whatever reason, this is the method for you. It involves opening up a text file and editing the password directly in it.

First, open the XAMPP Control Panel and click on the Explorer button on the right-hand side of the window:

The Explorer button in the XAMPP Control Panel.

This will launch a file browser in the XAMPP folder. Next, you can open the phpMyAdmin folder and locate the config.inc.php file:

The config.inc.php file in Windows.

You can open this file in your favorite text editor, or simply double-click on it to open it in the default program.

The line you’re looking for is $cfg[‘Servers’][$i][‘password’] = ‘YourPassword’; . Here’s what it looks like:

The line to edit the MySQL password in the config.inc.php file.

Once you locate it, you can enter your desired password between the single quotes, and then save the file. That’s all there is to it!

Summary

Whether you’ve forgotten your XAMPP MySQL password or you want to take your security up a notch, there are multiple methods you can use to change it. Updating your password helps keep your data secure, and provides an additional layer of defense against malicious activity.

In this article, we covered how to change your MySQL password on an XAMPP installation using three methods, which include using the command line, going through the phpMyAdmin GUI, and editing a file directly. You can choose whichever one suits your workflow best.

If you take security seriously and want to ensure that all of your WordPress sites are protected, consider hosting with Kinsta. Our plans offer the security, speed, and support your site needs to operate at its best.

Get all your applications, databases, and WordPress sites online and under one roof. Our feature-packed, high-performance cloud platform includes:

  • Easy setup and management in the MyKinsta dashboard
  • 24/7 expert support
  • The best Google Cloud Platform hardware and network, powered by Kubernetes for maximum scalability
  • An enterprise-level Cloudflare integration for speed and security
  • Global audience reach with up to 35 data centers and 260 PoPs worldwide

Get started with a free trial of our Application Hosting or Database Hosting. Explore our plans or talk to sales to find your best fit.

Deploy Your App or Database For Free

Choose from 25 data centers on Google Cloud Platform’s top-tier infrastructure. Enjoy a fair, usage-based pricing model, unlimited concurrent build limits, DDoS protection with Cloudflare, and advanced firewalls.

XAMPP Error 403 featured image.

How to Troubleshoot Error 403 in XAMPP

Have you encountered the «Error 403» message in XAMPP? Check out these three different ways to help you fix it.

Reading time 6 min read Publish date March 18, 2021 Topic HTTP Status Codes Topic Website Errors Topic XAMPP

DevKinsta is a free suite of local development tools to build, test, and deploy WordPress sites in minutes.

DevKinsta Documentation

DevKinsta is a local development suite for WordPress sites, allowing you to build, develop, and test sites. Use your favourite text editor to get s…

what is localhost

What Is Localhost? And How Does It Apply to WordPress?

Wondering what localhost means? Localhost generally refers to the actual computer that you’re working on. Read this post for more information!

Subscribe to our Newsletter

Keep up with the latest web development trends, frameworks, and languages.

Источник

Оцените статью