Creating users in mysql shell

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Creating users in mysql shell

Post by Steveo31 »

I'm having problems in the mysql shell creating anything. I've tried all the commands that I've come across

Code: Select all

C:\phpdev\mysql\bin\mysql -p -u root;
Enter Password:
Root shouldn't need a pass right off the bat, but ARG! Any way I can reset the server? I can't do it through the shell cause I cant set privilages!!!

Please help :)
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

rtfm? :p there is a whole section dedicated to it (or was it in the faq?)

Code: Select all

mysql -u root -p;
create table foo;
grant all on foo.* to 'user'@'localhost' identified by 'hispassword';


mysqladmin -u root -p reload
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

Code: Select all

mysql -u root -p
Enter Password:

ERROR 1045(28000): Access denied for user: 'root'@'localhost' <using password: NO>
Same for it with a password. I think I need to completely reset the privileges for mysql somehow.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I seem to remember fixing my problem with this by not even specifying a user, and switching it once I got in.. :?
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

Code: Select all

mysql -u
mysql option '-u' requires an arguement
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

I meant:

Code: Select all

feyd@devnetwork ~/devnetwork
$ mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.20a-nt

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

OK, not sure what you mean by that.

I downloaded the next stable version of MySQL, 4.1.9. I was able to get it installed and started with

Code: Select all

C:\>net start mysql
But when I try to connect with

Code: Select all

C:\phpdev\mysql\bin\>mysqld -u root
it gives me an error

Code: Select all

Microsoft Windows XP &#1111;Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>cd c:\phpdev\mysql\bin

C:\phpdev\mysql\bin>mysqld

C:\phpdev\mysql\bin>mysqld -u root
Can't start server: Bind on TCP/IP port: No error
050121 16:12:19  Do you already have another mysqld server running on port: 3306
 ?
050121 16:12:19  Aborting

050121 16:12:19  mysqld: Shutdown Complete
phpMyAdmin works fine, so the server is technically there, I just can't access it through the shell.

my.cnf if it helps:

Code: Select all

#This File was made using the WinMySQLAdmin 1.4 Tool
#4/15/2004 1:37:09 AM

#Uncomment or Add only the keys that you know how works.
#Read the MySQL Manual for instructions

&#1111;mysqld]
basedir=C:/phpdev/mysql
#bind-address=172.198.119.3
datadir=C:/phpdev/mysql/data
#language=C:/mysql/share/your language directory
#slow query log#=
#tmpdir#=
#port=3306
#set-variable=key_buffer=16M
&#1111;WinMySQLadmin]
Server=C:/phpdev/mysql/bin/mysqld-nt.exe
user=root
password=
&#1111;mysqld]
basedir=C:/phpdev/mysql
datadir=D:/phpdev/mysql/data

C:\phpdev\mysql\bin>
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

Well, somehow mysql.exe and mysqladmin.exe were deleted :?: I restored em and all is good. Whew ;)
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

mysqld = MySQL Daemon Service.. i.e. server. ;)
Steveo31
Forum Contributor
Posts: 416
Joined: Sun Nov 23, 2003 9:05 pm
Location: San Jose CA

Post by Steveo31 »

Ah... good to know. Ha, thanks :)

Any good links you have for something like this in the future?
Post Reply