Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place! |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
|
07-23-2012, 02:43 AM
|
#1
|
Member
Registered: Jul 2009
Posts: 262
Rep:
|
Executing mysql
Hi,
I have checked mysql on my system using:
I got
Code:
mysql: /usr/bin/mysql /usr/lib/mysql /usr/share/mysql /usr/share/man/man1mysql.1.gz
Kindly guide me how to execute mysql.
Zulfi.
|
|
|
07-23-2012, 02:44 AM
|
#2
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
you run "mysql"
see "man mysql" for full details of using the mysql command.
|
|
|
07-23-2012, 03:24 AM
|
#3
|
Member
Registered: Oct 2007
Location: Singapore
Distribution: OpenSuse, Slackware, Redhat
Posts: 318
Rep:
|
From your post, i assume mysql is already installed in your machine.
Execute these commands
Start the server
# usr/local/mysql/bin/mysqld_safe --user=mysql &
Check if server is starting
# /usr/local/mysql/bin/mysqladmin ping
If responds on the terminal tat sqld is alive, you have successful start the server.
|
|
|
07-23-2012, 03:32 AM
|
#4
|
Member
Registered: Jul 2012
Location: Delhi, India
Distribution: CentOS
Posts: 82
Rep:
|
To start with mysql you may need to set root password or create new user.
http://www.ntchosting.com/mysql/create-user.html
This link will help you to do the stuff
|
|
|
07-24-2012, 11:53 PM
|
#5
|
Member
Registered: Jul 2009
Posts: 262
Original Poster
Rep:
|
Hi,
I tried to execute mysql using
Code:
/usr/bin/mysql
ERROR 2002 (HY000): Can't connect to local MYSQL server through socket '/var/lib/mysql/mysql.sock (2)
However following command worked but it didnt recognize the user:
Code:
$ sudo /etc/init.d/mysql
password for guest:
guest is not in the sudoers file. This incident will be reported.
Kindly guide me how to create a user.
I checked the link provided above but i didnt find the command for creating user.
I also tried:
Code:
$mysqladmin
mysqladmin Ver 8.41 Distrib 5.0.67, for redhat-linux -gnu on i386
......
....
.....
Kindly guide me how to execute mysql.
Zulfi.
|
|
|
07-25-2012, 12:27 AM
|
#6
|
Member
Registered: Jul 2012
Location: Delhi, India
Distribution: CentOS
Posts: 82
Rep:
|
Command to set root password :
/usr/bin/mysqladmin -u root password 'root_password'
Create a database :
/usr/bin/mysql -u root -p'root_password' -e "create database db_name"
Create new user :
/usr/bin/mysql -u root -p'root_password' -e "CREATE USER 'user_name'@'127.0.0.1' IDENTIFIED by 'user_password';"
Grant privileges :
/usr/bin/mysql -u root -p'root_password' -e "grant all privileges on 'db_name'.* to 'user_name'@'127.0.0.1' identified by 'user_password'"
I guess, now you can create a new user and assign privileges on a perticular database.
|
|
|
07-25-2012, 12:35 AM
|
#7
|
Member
Registered: Jul 2012
Location: Delhi, India
Distribution: CentOS
Posts: 82
Rep:
|
before executing these command please ensure that mysql is running
service mysql status
if it is stopped, start it with
service mysql start
|
|
|
07-25-2012, 01:55 AM
|
#8
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
Hmm... he appears to be using an account called "guest"... doesn't bode well for getting root access to me...
|
|
|
07-25-2012, 02:17 AM
|
#9
|
Member
Registered: Jul 2009
Posts: 262
Original Poster
Rep:
|
Hi,
Thanks for your reply.
I tried:
Code:
guest@HP-UX645PA ~]$ service mysql start
mysql: unrecognized service
Then:
Code:
[guest@HP-UX645PA ~]$ /usr/bin/mysqladmin -u root password
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)'
Check that mysqld is running and that the socket: '/var/lib/mysql/mysql.sock' exists!
Then:
Code:
[guest@HP-UX645PA ~]$ service mysqld start
touch: cannot touch `/var/log/mysqld.log': Permission denied
chown: changing ownership of `/var/log/mysqld.log': Operation not permitted
chmod: changing permissions of `/var/log/mysqld.log': Operation not permitted
chown: changing ownership of `/var/lib/mysql': Operation not permitted
chmod: changing permissions of `/var/lib/mysql': Operation not permitted
Timeout error occurred trying to start MySQL Daemon.
Starting MySQL: [FAILED]
Kindly guide me with problem.
Zulfi.
|
|
|
07-25-2012, 02:22 AM
|
#10
|
Moderator
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417
|
mysqld isn't installed I guess. If you're on a redhat clone, try "yum install mysql-server" however as above I'm concerned that you have no root access to this system as you're on a "guest" account.
What do you actually want to do with MySQL in the first place? You expect to use a database running on the local machine, or connect somewhere else? You seem to be just copying and pasting random commands given here to you, so some clarity on your actual goals would help everyone I think.
Last edited by acid_kewpie; 07-25-2012 at 02:32 AM.
|
|
1 members found this post helpful.
|
07-25-2012, 02:24 AM
|
#11
|
Member
Registered: Jul 2012
Location: Delhi, India
Distribution: CentOS
Posts: 82
Rep:
|
Sorry it was mistaken the work
try :
service mysqld status
if it is stopped then
service mysqld start
|
|
|
07-25-2012, 02:48 AM
|
#12
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
The program "mysql" is the client you use to connect to a mysql server. The program "mysqld" is the server program. It runs as a service, and you should have the service start when you boot.
You should download the mysql reference manual for your mysql version (run "/usr/sbin/mysqld --version" to find out your version) It has instructions on creating users, and importantly, what you need to do after installing mysql to secure it.
http://dev.mysql.com/doc/
You need to create a password for the root mysql user. Dropping the default demo database is also advisable. See section 2.10.2: "Securing the Initial MySQL Accounts"
|
|
|
07-25-2012, 08:20 PM
|
#13
|
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,391
|
As ref post#10, please tell us what distro+version you have, as this will make a difference to the cmds you require.
Code:
uname -a
cat /etc/*release*
|
|
|
07-30-2012, 01:31 AM
|
#14
|
Member
Registered: Jul 2009
Posts: 262
Original Poster
Rep:
|
Hi,
I tried the cat command and I got following output:
Code:
[guest@HP-UX645PA ~]$ cat /etc/*release*
Fedora release 10 (Cambridge)
cat: /etc/lsb-release.d: Is a directory
Fedora release 10 (Cambridge)
Fedora release 10 (Cambridge)
cpe://o:fedora_project:fedora:10
[guest@HP-UX645PA ~]$
Kindly guide me.
Zulfi.
|
|
|
07-30-2012, 01:33 AM
|
#15
|
Member
Registered: Jul 2009
Posts: 262
Original Poster
Rep:
|
Hi,
I also tried:
Code:
[guest@HP-UX645PA ~]$ uname -a
Linux HP-UX645PA 2.6.27.5-117.fc10.i686 #1 SMP Tue Nov 18 12:19:59 EST 2008 i686 i686 i386 GNU/Linux
[guest@HP-UX645PA ~]$
Zulfi.
|
|
|
All times are GMT -5. The time now is 12:51 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|