On Sun, 26 Sep 2004 16:11:43 +0530 (IST), Sudhanshu Ambesange
> While granting permissions to different user in MySQL thru phpmyadmin , I
> deleted permission of root ( probably root user). Now getting error as
> follows. How can I fix it ?
Hi,
I am Vishal Rao, System Engineer at E-Lock Technologies (Frontier
Tech, Tellus Tech) in Pune. (www.elock.com , www.tellustech.com)...
email [EMAIL PROTECTED], you can email me directly if you need.
Did you follow the correct steps in installing MySQL? You need to
create a mysql user and group and do some chown and chgrp and also run
the mysqladmin command to set the root password and also connect to
mysql with "mysql -u root -p" then run the grant command in there...
im sorry i dont recall the steps exactly but we faced similar problems
here at my office recently... just following the install procedure
properly solved it...
but you say you deleted the user root or something like that? then try
running mysqladmin command to set root password etc
here is a clip from our document...
[snip]
Method 1:
=========
shell> /bin/mysqladmin -u root -p password 'new password'
shell> Enter Password: <enter old password of root which is blank
initially so just press the enter key>
shell> /bin/mysqladmin -u root -h <hostname> -p password 'new password'
shell> Enter Password: <enter old password of root which is blank
initially so just press the enter key>
[...snip]
HTH (Hope That Helps)
PS: I have also attached a txt file which we refer during mysql
installation, HTH
--
"Thou shalt not follow the null pointer for at its end madness and chaos lie."
MYSQL SET UP ON LINUX.
_____________________
REQUIRED FILES:
1.MYSQL.JAR
2.MYSQL-3.TAR.GZ
-------------------------------------------------------------------------------------------------
shell> groupadd mysql
shell> useradd -g mysql mysql
shell> cd /usr/local
rename the MySQL Package to MYSQL package tar.gz
shell> tar xvfz <path of mysqlpackage.tar.gz>
** link/shortcut to mysqldir (recommended)
shell> ln -s mysql-VERSION-OS mysql
[ command strusture is
mysql-VERSION-OS : Actual MYSQL directory name which is too big is rename to mysql
Note: Actual path of the MYSQL is too big so we create a link to same folder by
creating above link.]
shell> cd mysql
shell> scripts/mysql_install_db
shell> chown -R root /usr/local/mysql
shell> chown -R mysql /usr/local/mysql/data
shell> chgrp -R mysql /usr/local/mysql
shell> chown -R root /usr/local/mysql/bin
**shell> bin/safe_mysqld --user=mysql &
shell> ./configure --prefix=/usr/local/mysql
**After the above command, the daemon wil start
**To test that the sql server is up and running
./bin/mysqladmin version
***************************************************************************************************
To set user root password as abcd
---------------------------------------
Method 1:
=========
shell> /bin/mysqladmin -u root -p password 'new password'
shell> Enter Password: <enter old password of root which is blank initially so just
press the enter key>
shell> /bin/mysqladmin -u root -h <hostname> -p password 'new password'
shell> Enter Password: <enter old password of root which is blank initially so just
press the enter key>
for example:
shell> /bin/mysqladmin -u root -h <hostname> -p password 'abcd'
shell> Enter Password: <press enter key>
shell> bin/mysql -h <host> -u root -p
shell>Enter Password:<abcd>
you will get the mysql prompt
mysql>
create the required databse
mysql>create database archive;
to check that it has got created
mysql>show databases;
TO ACCESS THE DATABASE FROM WEBSERVER WE NEED TO ADD MYSQL.JAR TO JAKARTA
TOMCAT\COMMON\LIB FOLDER.
IN CASE IF SERVER IS LOCATED AT ANOTHER MACHINE AND NEED TO ACCESS MYSQL DATABASE THEN
WE NEED TO GRANT PERMISSIONS FROM MYSQL SERVER PROMPT.
EX.
mysql>GRANT ALL PRIVILEGES ON *.* TO ROOT@<HOSTNAME> IDENTIFIED BY '<PASSWORD>'
*.* FOR ACCESSING ALL THE DATABASE FILES CREATED ON MYSQL MACHINE.
HOSTNAME : TOMCAT SERVER MACHINE NAME.
PASSWORD : SET THE PASSWORD TO ACCESS THE DATABASE.
mysql>GRANT ALL PRIVILEGES ON *.* TO [EMAIL PROTECTED] IDENTIFIED BY 'abcd'
_________________________________________________________________________________________________
Method 2:
=========
The following procedure will help you reset the root password. Note that while you are
doing this, the server is totally open and gives everybody full access to all
databases.
1. Stop the MySQL server
2. Restart the MySQL server with the command-line option -Sg or --skip-grant-tables
/path/to/safe_mysqld --skip-grant-tables
You can now log in to the server without a password. So can anyone else!
3. Connect to the mysqld server with command "mysql -h hostname mysql" and change the
password with the command
**To insert a record into table user in database mysql
mysql> INSERT INTO user (Host,User,Password) VALUES('%','root',PASSWORD('abcd'));
**
GRANT USAGE ON *.* TO jeffrey@"%" IDENTIFIED BY 'biscuit';
OR
mysql -> GRANT ALL PRIVILEGES ON *.* TO "root"@"localhost"
-> IDENTIFIED BY "the_new_password"
4. Exit the client
5. Immediately thereafter, shut down and restart the MySQL server as usual.
The manual states that you can use FLUSH PRIVILEGES or the command mysqladmin reload
frm the command line to make a running MySQL start using the grant tables. The manual
also says that changes in grant tables aren't noticed for clients already connected to
the server. If any clients have connected to the server while you were doing this,
they have full access as long as they keep the connection open. The choice is yours.
***************************************************************************************************
**Before this command is executed, make sure that the /etc/hosts file contains an
entry for the host name and ip address
shell> bin/mysqladmin -u root -p password 'abcd'
shell> bin/mysql -h host -u user -p archive
show tables;
** To start mysql at startup
cd /etc/rc.d
vi rc.local
** add the following line at the end of this file
/bin/sh -c 'cd /<path where mysql is installed> ; ./bin/safe_mysqld --user=mysql &'
IMPORTANT*****
If you are using tomcat as webserver and mysql as a database server, you need to copy
MYSQL.JAR (present on r:\java\mysql-linux) in /opt/jakarta-tomcat4.0.1/common/lib/
folder.
shut down and restart the webserver.
[you don't need to add this into a classpath if the webserver is tomcat.]
--
______________________________________________________________________
Pune GNU/Linux Users Group Mailing List: ([EMAIL PROTECTED])
List Information: http://plug.org.in/mailing-list/listinfo/plug-mail
Send 'help' to [EMAIL PROTECTED] for mailing instructions.