What is localhost and root in mysql?

 mySQL: what does "local host" and "root" mean?, in the line "$link = mysqli_connect['localhost', 

JRBobDobbs

Apr 18 2010, 08:32 PM

Member

Group: Members
Posts: 41
Joined: 2-November 09
Member No.: 10,212



Hello.

I'm trying to set up a very basic mySQL database. I'm having some problems with the terminology, specifically what "local host" and "root" refers to in the line "$link = mysqli_connect['localhost', 'root', 'password'];"? One of them I guess is the file path of the mySQL directory file [which I assume would be stored in my web host's files]. But which of the two is it, and what does the other term refer to?

Thanks in advance for any help.

This post has been edited by JRBobDobbs: Apr 18 2010, 08:33 PM

Darin McGrew

Apr 18 2010, 09:03 PM

WDG Member

Group: Root Admin
Posts: 8,348
Joined: 4-August 06
From: Mountain View, CA
Member No.: 3



The parameters are the hostname ['localhost' is the same machine], the username ['root' is the superuser account for UNIX/Linux systems], and the password [the password for the username specified].

Note that it is better not to use root.

JRBobDobbs

Apr 18 2010, 09:20 PM

Member

Group: Members
Posts: 41
Joined: 2-November 09
Member No.: 10,212



QUOTE[Darin McGrew @ Apr 18 2010, 10:03 PM]

The parameters are the hostname ['localhost' is the same machine], the username ['root' is the superuser account for UNIX/Linux systems], and the password [the password for the username specified].

Note that it is better not to use root.

Thanks for the reply.

I still don't know what you mean by "hostname", though. Are you referring to the URL of my web service provider?

That is useful information about the root, I didn't realize the root was optional [I don't know anything about UNIX/Linux systems so I assume it doesn't apply to me].

JRBobDobbs

Apr 19 2010, 12:15 AM

Member

Group: Members
Posts: 41
Joined: 2-November 09
Member No.: 10,212



I stumbled across my hostname, that's OK now.

Thanks again for the help.

1 User[s] are reading this topic [1 Guests and 0 Anonymous Users]

0 Members:

What is localhost and root?

localhost means your own computer, root is a super high privilege mode that lets you do anything to your computer, you generally don't want to use it.

How do I find MySQL localhost?

Go ahead and open MySQL Workbench and let's connect to this new local server. Click on the “New Connection” icon and leave everything default, except the “Connection Name,” here enter localhost . Double click on the new connection and enter the password you created during installation. Voila!

How set MySQL root password localhost?

Use the following procedure to set a root password. To change the root password, type the following at the MySQL/MariaDB command prompt: ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyN3wP4ssw0rd'; flush privileges; exit; Store the new password in a secure location.

Should I run MySQL as root?

On Unix [or Linux for installations performed using tar. gz packages] , the MySQL server mysqld can be started and run by any user. However, you should avoid running the server as the Unix root user for security reasons.

Chủ Đề