Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


MySQL Setup

I've been trying to setup mysql properly, but it isn't working. This won't be locally stored, so from my own understanding I shouldn't be using 'kai'@'localhost' rather I use @'%' correct? I have tried following guides everywhere I could find, but they don't get it working. I want to setup a database called 'eve' and have a user on it called 'kai' that I can use for my remotely hosted site (it's a VPS if that changes anything). It's not that I'm unwilling to learn but it's on Linux and I don't have cpanel with my host. I have set up the database, mysql, etc. I've also tried setting up phpmy admin but couldn't figure it out so I figure it should just be a few ssh mysql commands or no? So far:

create user 'kai'@'%' identified by password 'mypass' grant all privileges on . to 'kai'@'%' with grant option;

ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'grant all privileges on . to 'kai'@'%' with grant option' at line 1

that's one example

I've tried several different ways including @%, @localhost, etc. i tried going through the mysql guide they have in place, but it didn't help too much. I considered maybe I needed to use @192., etc, but I don't think that'd be secure.

Any pointers would be excellent, I'm sure I'm just skipping something easy and I don't know the proper terminology to google or I would have found it already ;). This is on Debian 7 64bit, dunno how important that is but everything is updated, etc.

I've been following this: http://dev.mysql.com/doc/refman/5.5/en/adding-users.html

errors I've been having: 1396, 1064 and a couple of others. I'm essentially wanting to do what someone would normally easily do through cPanel, etc. but in a ssh client. If there's a way to setup something like that to where I would have a gui to work with, that'd be something I wouldn't have a problem trying.

Should I be using localhost? My IP? sdnam.net?

error 1396 create user 'kai'@'%' identified by password 'mypass'; ERROR 1396 (HY000): Operation CREATE USER failed for 'kai'@'%


1 Answer

Faizal Heesyam
Faizal Heesyam
8,843 Points

i believe some WebUI tools will help ease your job here.. since you're on a vps, you are free to setup your own admin UI (something like cpanel), but since cpanel is a commercial app (paid), you may consider install Webmin (free alternative to cpanel)..