LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 12-23-2007, 12:09 PM   #1
lin_myworld
Member
 
Registered: Oct 2007
Location: India
Distribution: Ubuntu 8.04
Posts: 93

Rep: Reputation: 15
How to configure MYSQL ..


[FONT="Times New Roman"]I got the solution to my problem on my own.


Check it out here :
How to setup MYSQL in Suse.

What i m using:
Suse 10.2
Apache2 webserver
MYSQL Ver 14.12 Distrib 5.0.26, for suse-linux-gnu (i686)

To start APACHE2 server
In terminal type
Code:
/etc/init.d/apache2 start
and similarly To start MYSQL server type:
Code:
/etc/init.d/mysql start
Now if ur running mysql first time you should set the root superuserpassword of mysql which is by default empty.

Now, My Problem was :

Whenever i want to create a database using sql command and type mysql in terminal it prints the following message.

Code:
suse:~ # mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
manni is the other user in my pc. i login in as manni and then type mysql it works. terminal prompt changes to mysql but it does not have the privilege to create,remove or alter databases.Lter i founnd that the anonymous login was is on which is by default for testing.It should be switched of for security purposes. mysql has also a defult database called test which should also be deleted.

so,
1)The root superuser is never allowed to access mysql through terminal due to security reasons but u can enable it ... see below for it.

2)however root is given aceess to all the databses through localhost. for eg.when i was trying to install a forum in my webserver in installation process it asked for user and user password.and for all databases root user and password works.

3)Now u will be wondering what the use of root password then if it cannot access mysql through terminal and cannot use sqlcommands.but remember root can acess all command through localhost.

take a example:
I created a user xyz and assign it to database php and give it only the privilge of queryin the database i.e. using only SELECT command and used this user information while installing a forum ..the followin error occured.

Code:
A fatal and unrecoverable database error has occurred. This may be because the specified user does not have appropriate permissions to CREATE TABLES or INSERT data, etc. Further information may be given below. Please contact your hosting provider in the first instance for further assistance.
The best practice involved while installing database driven applications is to create a database and assign it to user and give it to the basic privilege of creating,altering,deleting,querying and modifying tables. rather than using root due to security purposes.

How to enable root to access commands through terminal and to remove the anonymous user settings and the test database
just run the mysql_secure_installation command in terminal and follow on screen steps.

To assign user to a particular database and asssign him the privileges.
run the mysql_setpermission command in terminal and enter the root super userpassword u will get the folowing screen:
Code:
######################################################################
## Welcome to the permission setter 1.3 for MySQL.
## made by Luuk de Boer
######################################################################
What would you like to do:
  1. Set password for an existing user.
  2. Create a database + user privilege for that database
     and host combination (user can only do SELECT)
  3. Create/append user privilege for an existing database
     and host combination (user can only do SELECT)
  4. Create/append broader user privileges for an existing
     database and host combination
     (user can do SELECT,INSERT,UPDATE,DELETE)
  5. Create/append quite extended user privileges for an
     existing database and host combination (user can do
     SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,
     LOCK TABLES,CREATE TEMPORARY TABLES)
  6. Create/append database administrative privileges for an
     existing database and host combination (user can do
     SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,
     CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS)
  7. Create/append full privileges for an existing database
     and host combination (user has FULL privilege)
  8. Remove all privileges for for an existing database and
     host combination.
     (user will have all permission fields set to N)
  0. exit this program

Make your choice [1,2,3,4,5,6,7,0]:
make ur choice and do whatever u want to do.


At last, remember never share ur root superuser password with anyone because it has all privileges and it sets other privileges. and through it one can easily hack ur database.

Plz leave reply post if helps u in anyway and ask questions if there r doubts. I love to do experimenting all around. and if i got anything new i will sure update this post.

All the things i learnt while experimenting when i got stuck wid my problem..thats the most xciting part of linux u learn while xperimenting..
 
Old 12-23-2007, 12:18 PM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
I would recommend reading the manual. There is a section on securing mysql after the initial setup. ( On openSUSE 10.2 the mysql package supplies the manual in /usr/share/doc/packages/mysql) For openSUSE 10.3, you need to download the manual from the mysql site.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to configure MySql ODBC julian.osorio Linux - Software 1 06-09-2006 04:02 AM
How to configure Mysql redhat 9.0 selvakumar1 Red Hat 1 02-01-2006 07:23 AM
how to configure mysql ? sebasjuh Mandriva 3 09-21-2004 07:04 AM
MySQL setup stops at command "./configure --prefix=/usr/local/mysql" k41184 Linux - Software 1 05-20-2004 03:44 PM
mysql - ./configure - dont understand... ilhbutshm Linux - Software 3 03-19-2004 12:03 AM


All times are GMT -5. The time now is 03:58 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration