LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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-13-2011, 11:50 PM   #1
Darth_Krodak
LQ Newbie
 
Registered: Dec 2011
Posts: 6

Rep: Reputation: Disabled
Having issues running mysql from command line


Hey I'm trying to set up a website using a a remote web server, I'm using CemtOS 5 and I haven't yet set up the GUI so I'm using command line and I was wondering how to run a .sql file through command line

I already tried imputing the command:

mysql -u Username -p DBname < program.sql

I keep on receiving a prompt saying "Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)"

any suggestions
 
Old 12-14-2011, 12:14 AM   #2
powerxcat
LQ Newbie
 
Registered: Aug 2009
Posts: 13

Rep: Reputation: 0
Did you start your MySQL service??
 
Old 12-14-2011, 12:23 AM   #3
Darth_Krodak
LQ Newbie
 
Registered: Dec 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
yea sorry I'm a complete newb. I havent started mysql service, how would I go about doing that and would it fix the problem
 
Old 12-14-2011, 12:29 AM   #4
powerxcat
LQ Newbie
 
Registered: Aug 2009
Posts: 13

Rep: Reputation: 0
Please try this command:
Code:
service mysqld start
 
Old 12-14-2011, 12:51 AM   #5
Darth_Krodak
LQ Newbie
 
Registered: Dec 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
I got

-bash: service: command not found
 
Old 12-14-2011, 01:04 AM   #6
powerxcat
LQ Newbie
 
Registered: Aug 2009
Posts: 13

Rep: Reputation: 0
Please try
Code:
yum install initscripts
yum install mysql*
 
Old 12-14-2011, 01:11 AM   #7
Darth_Krodak
LQ Newbie
 
Registered: Dec 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
I tried both commands the 1st one told me I already had it installed and up to date, the second one just installed on the machine, What do I do now?
 
Old 12-14-2011, 03:44 AM   #8
powerxcat
LQ Newbie
 
Registered: Aug 2009
Posts: 13

Rep: Reputation: 0
Code:
/etc/init.d/mysqld start
If its work, you can run your command:
Code:
mysql -u Username -p DBname < program.sql
The username should be root.
 
Old 12-14-2011, 10:15 AM   #9
Darth_Krodak
LQ Newbie
 
Registered: Dec 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
When I ran the first code it said "Starting MySQL:" When I attempted to run the second code (as root) I recieved "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)"
 
Old 12-14-2011, 11:53 PM   #10
powerxcat
LQ Newbie
 
Registered: Aug 2009
Posts: 13

Rep: Reputation: 0
By default, the password for root is blank.
 
Old 12-15-2011, 03:26 AM   #11
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,624

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
it has been a bit but i thought that MySQL used the default install settings of
username : root
password: password

think of setting up a LAMP stack as a collage class with a pass/fail a 4.0 or 1
you MUST get a 4.0

so a bit of studying is REQUIRED
the Apache dosc are EXTENSIVE and so is the mysql doc pages
a few THROUGH read through are a VERY good idea

Apache
http://httpd.apache.org/docs/2.2/
mysql
http://dev.mysql.com/doc/
http://dev.mysql.com/doc/mysql-linux...tallation.html
 
Old 12-15-2011, 03:58 AM   #12
linuxrndblog
Member
 
Registered: Oct 2010
Location: India
Posts: 89

Rep: Reputation: 2
Dear Darth,

Have u set the root password of mysql after installing it? If no so don't pass the option -p in command.

mysql -u root DBname < program.sql

and for mysql login/console/prompt just type mysql adn hit enter key.

i.e. [root@XLSGOPCP ~]# mysql

powerxcat said right.....By default, the password for mysql root is blank.
 
Old 12-15-2011, 05:07 PM   #13
Darth_Krodak
LQ Newbie
 
Registered: Dec 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
Hey powerxcat that fixed the issue, I appreciate it
 
Old 12-16-2011, 02:18 AM   #14
linuxrndblog
Member
 
Registered: Oct 2010
Location: India
Posts: 89

Rep: Reputation: 2
Dear Darth,

Great..........
 
  


Reply



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
Command Line Resolution Issues K_REY_C Linux - Hardware 11 08-06-2010 05:37 AM
mysql works from command line, but mysql.sock (13) error from php.. leif_84 Linux - Server 0 07-23-2007 12:59 PM
Command line network config issues gigi1234 Linux - Networking 4 08-25-2006 04:24 AM
MySQL 4.0.12 - command-line tetractis Programming 0 07-04-2003 06:00 AM
MySQL command line buddy Linux - General 3 01-16-2003 08:14 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:16 AM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration