New Feature: Playlist Center! Pick a topic and let our playlists guide the way.

Start learning with our library of video tutorials taught by experts. Get started

MySQL Essential Training
Illustration by Don Barnett

Setting up MySQL users


From:

MySQL Essential Training

with Bill Weinman

Video: Setting up MySQL users

In this movie I'm going to show you how to This movie applies to both Mac and Windows systems. Here we the default xant page up in the browser and Now we're going to come down here to PHP My Admin and I'm going to And those selected users have been deleted, And, I'm going to retype it in the Retype box.
Expand all | Collapse all
  1. 4m 22s
    1. Welcome
      1m 3s
    2. Using the exercise files
      1m 31s
    3. What is MySQL?
      1m 48s
  2. 45m 37s
    1. Installation overview
      3m 16s
    2. Installing XAMPP on Windows
      5m 55s
    3. Installing XAMPP on the Mac
      6m 38s
    4. Setting up MySQL users
      11m 31s
    5. Installing SID on Windows
      5m 43s
    6. Installing SID on the Mac
      6m 6s
    7. Installing time zone support in MySQL on Windows
      6m 28s
  3. 45m 43s
    1. The SELECT statement
      3m 57s
    2. Selecting rows
      4m 57s
    3. Selecting columns
      3m 8s
    4. Sorting results with ORDER BY
      2m 58s
    5. Filtering results with WHERE
      3m 52s
    6. Filtering results with LIKE and IN
      3m 41s
    7. Filtering results with regular expressions
      8m 21s
    8. Inserting rows
      4m 9s
    9. Updating rows
      2m 21s
    10. Deleting rows
      2m 25s
    11. Literal strings
      3m 12s
    12. Understanding NULL
      2m 42s
  4. 41m 47s
    1. Creating a database
      4m 30s
    2. Creating a table
      7m 18s
    3. Creating indexes
      6m 8s
    4. Controlling column behavior with constraints
      4m 46s
    5. Creating an ID column
      6m 58s
    6. Using foreign key constraints
      7m 58s
    7. Altering a table
      4m 9s
  5. 28m 56s
    1. What are data types?
      4m 1s
    2. Numeric types
      5m 21s
    3. String types
      2m 58s
    4. Date and time types
      7m 2s
    5. Bit type
      2m 26s
    6. Boolean values
      2m 15s
    7. Enumeration types
      4m 53s
  6. 32m 34s
    1. String functions
      6m 57s
    2. Numeric functions
      6m 2s
    3. Date and time functions
      4m 12s
    4. Time zones in MySQL
      3m 37s
    5. Formatting dates
      1m 51s
    6. Aggregate functions
      5m 45s
    7. Flow control with CASE
      4m 10s
  7. 7m 6s
    1. Maintaining database integrity with transactions
      4m 46s
    2. Using transactions for performance
      2m 20s
  8. 16m 49s
    1. Updating a table with a trigger
      5m 11s
    2. Preventing automatic updates with a trigger
      7m 29s
    3. Logging transactions with a trigger
      4m 9s
  9. 14m 11s
    1. Creating a simple subselect
      3m 23s
    2. Searching within a result set
      3m 53s
    3. Creating a view
      3m 32s
    4. Creating a joined view
      3m 23s
  10. 12m 26s
    1. Understanding MySQL stored routines
      2m 0s
    2. Creating a stored function
      4m 34s
    3. Creating a stored procedure
      5m 52s
  11. 14m 4s
    1. The multi-platform PDO interface
      3m 44s
    2. Executing the SQL
      4m 8s
    3. Implementing auto-increment IDs
      2m 3s
    4. Using a stored funciton
      4m 9s
  12. 1m 3s
    1. Goodbye
      1m 3s

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
please wait ...
MySQL Essential Training
4h 24m Beginner May 14, 2014

Viewers: in countries Watching now:

MySQL is by far the most popular database management system for small- to medium-sized web projects. In this course, Bill Weinman provides clear, concise tutorials that guide you through creating and maintaining a MySQL database of your own. Bill explores the basic syntax, using SQL statements to create, insert, update, and delete data from your tables. He also covers creating a new database from scratch, as well as data types, transactions, subselects, views, and stored routines. Plus, learn about the multi-platform PHP PDO interface that will help you connect your database to web applications.

Topics include:
  • Writing queries
  • Creating and updating databases and tables
  • Using MySQL built-in functions
  • Sorting and filtering data
  • Updating tables with triggers
  • Working with subselects and views
  • Creating and using a stored function
Subjects:
Developer Databases
Software:
MySQL
Author:
Bill Weinman

Setting up MySQL users

In this movie I'm going to show you how to set up the MySQL users you'll need for this course. MySQL is a server, even though you have it running on your Desktop machine, it's still server Software. MySQL maintains it's own security system that involves usernames, passwords and permissions. This is separate and distinct from the usernames and passwords on your computer, so it needs to be managed separately. This movie applies to both Mac and Windows systems. The process is identical, there's one small detail that's different and I'll show you that on both platforms.

Here we the default xant page up in the browser and I'm using the Chrome browser, you can use whatever browser you like. And you notice it says local host XAMPP for the address and we're on the little welcome screen. If I select the one that says security, you'll notice that you have some red bullets that say insecure, insecure, insecure. We're not going to fix all of these problems. It's important to understand that this is a developer tool and it contains inherent risks. Development tools are often insecure. They need to be in order to allow developers the power and access to do their job.

It's important that you run this Software behind a Firewall, most consumer level internet routers include a firewall, be sure that you understand how it works and that's it's turned on and functioning. Now we're going to come down here to PHP My Admin and I'm going to click on that and you'll see that it opens in a new tab here. And I'm going to come over and select users. Now you'll notice that there are a few users here, most of them were not using. I just want to talk a little bit about how users and privileges work in.

MySQL, you notice that for each user there's a User Name and a Host. And you notice that for example the root user, there's two versions of the root user, one for local host and one for a host named Linux. These are completely different. If I change the Password and Privileges for the one from local host, if you have a machine named Linux and you log in as root from that machine, it will still have no password. So first thing I'm going to do here is I'm going to select the ones that say Linux, and I'm going to go ahead and delete them.

So I checked the box next to both of those and under Remove selected users I'm going to press Go. And those selected users have been deleted, now I'm just going to close, I'm not sure why that would generate an error but if I press Reload, we'll see that those. Users are gone. Now our root at local host user, I'm going to go ahead and edit the privileges. That's the user that is being used for the phpMyAdmin software.

So if I say Edit Privileges. You'll notice that all of the privileges here are checked. And if we go back to that user screen, you'll see it says all privileges. This is the power user. This is the root user. You need this in order to manage the database. Which is why phpMyAdmin uses it. And it has lots of privileges. So you want to make it as secure as you possibly can. Now again you're behind a firewall. This is on your personal machine. You know, you could argue that it's not important, but at least you do need to know how to do it, so global privileges, check all is checked.

All privileges are available for this user, and if we scroll down here change password, you'll notice that there's no password now. So we're going to type password in here, and I'm going to type a password. And, I'm going to retype it in the Retype box. And I suggest that you pick a relatively good password for this. You're just going to need to enter it in one or two places. So, it doesn't necessarily even need to be something that you remember. But you will want to remember it long enough or write it down or copy and paste it to a file or something so that you can remember it long enough to enter it into the software that we're going to need to use it for in a little bit.

So, here under change password, I've typed in the new password and I'm going to press Go and you'll notice that. PhpMyAdmin no longer works. So, if I come over here and I click on Users, we get this Access Denied. And if I close this and I come back over here to our XAMPP home page and click on phpMyAdmin I get Access Denied and that's the way that it should be. Now, we need to enter that password in the php. Script for phpMyAdmin, and that's going to work like this.

On a Mac, this is how to have the root password to phpMyAdmin. So, I'm going to come over here to Finder and press Cmd+N to open a new Finder window. And under Applications, and XAMPP. And then I'm going to come into XAMMP files and I'm going to find phpMyAdmin right there. And config.ink.php now first thing I'm going to do here is I'm going to Ctrl+Click and bring up the get info because we don't have permission to open this file.

You notice down here that. Everyone has Read-only permission. So I can open it in my editor, look at it, but I can't change it. So the first thing I need to do is give myself permission to edit this file. So I'm going to click on this little lock here, and type in my system password. And now, all of this opens up and my plus button is available. So that I can Add a user, so I'm going to press Plus and I'm going to add myself here, Bill Wiseman, select. And I'm going to give myself read, write permission and I'll press the lock again.

And type my password again and now for this file, which is this config.inc.php, I now have read write permission, so I'm going to right click on this and Open With and I'm going to select Text Wrangler. Down here it says default for me, it might not say that for you. You might need to click other and select it. I've got it set up on my system to open php files with Text Wrangler. I'm going to click on Text Wrangler here and it opens this file in my Text Editor and I'm going to scroll down here until right around line 31, has a place for a root password and I'm going to type in the password that I typed in before, now you're going to see my password.

Do not type the same password that I'm typing. And obviously this is not a password that I use for anything else, this is a throw away password that I use for demonstrating in videos and things. I'm going to press Cmd+S to save that and I'm going to close text regular with Cmd+Q and we're going to come back out here to phpMyAdmin and I'm going to close this info screen there too. Close my Finder window, and when I come back out here, and press Reload, our phpMyAdmin now works. And it's now secure because we come out here, and our root password has a password.

And so that is all working. On a PC, this is how to add the root password to phpMyAdmin. First we're going to run Notepad++ and if you haven't already pinned this to your Taskbar, now may be a good time. So, I'm going to come up here to the Local Disk. And in program files, Notepad++ find the XE file and Right Click and pin this to the Taskbar. And so now I can run it any time I want to, and now we're going to go ahead and open the configuration file for phpMyAdmin.

And we'll find that here so you can see the path up here local c disc zamp phpMyAdmin. And we're going to find the file called config.ink.php right there. So I'll just Double Click on that and it opens here in notepad plus plus and right here around line 21 you see this space for the root password. I'm just going to type in the password that I entered in phpMyAdmin. And press Ctrl+S to save it and go ahead and close this and close Notepad++, close our Explorer window there and press Reload and now phpMyAdmin is working.

If we come over here to users we see that it now says yes under password for root local host. We're going to create a couple more users, now, for a couple of other purposes. First we're going to create a web user for use with various web applications. And you'll want to know how to do this because whenever you create a web application that uses a php server, you're going to want to have a user with the minimum permissions for that. So over here I'm going to select Add user. And we're going to give it a user name, I'm going to type web.

Any any host, I'm just going to say local host. In the case of creating users for your use, you're going to need to know the architecture of your system. You're usually going to put in a host name here for the host of the web server that's going to be connected to the data base so. Where our connections will come from is localhost. And I'm going to type in a Password. And I'm going to type the same Password in again. And this web user does not need to be able to create databases. It does not need to be able to grant privileges. It really just needs this stuff here: SELECT, INSERT, UPDATE, and DELETE.

Now, if your web application also needs to create or alter tables or indexes or drop tables or anything like that, then you might want to put that in here. And if it needs to grant any of these other permissions or have any of these other permissions, then you'll want to put those in here. But for most web applications, you're just going to need these ones over here on the left so I selected FILE as well. All of these are pretty safe for any user and then I'll press Go and we now have a web user. We're going to use that a little bit later on in the course.

We have one more that we need to create and this is for SID and I'm going to call this SID so I'm going to select Add user again and. I'm going to type in the name SID, S-I-D and again this is local host. Now SID is going to need to do everything. I'll type in a Password here. SID is going to need to be able to do everything. So I'm going to select Check All and just like root it has all of these permissions because we're going to be doing all of these things from within SID. So when we press go, now you might ask well why don't I just use the root password.

You don't want to use that for anything, in fact. If I were setting up a phpMyAdmin, for production use, I wouldn't even use root for that. I'm just using root because that's the way this one came. You notice up here at the top you get the SQL that's generated for this user that you just added. In fact, everything in MySQL is done through SQL, even creating users. So now we've set up all of the users that we need. We have our SID user for SID, we have our web user that we're going to use for another application later on in the course.

Now that you have these users set up, we'll finish the installation in the next movie by installing the SID application.

There are currently no FAQs about MySQL Essential Training.

 
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

join now Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed MySQL Essential Training.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.