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.
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.
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.