Jump to content
xisto Community
nightfox1405241487

MySQL Problem! Can't Connect To Server help

Recommended Posts

Hi, not sure if this is the correct spot but it is on MySQL which is database software! ;) Ok, I am configuring a server for practice and I have run into problems with MySQL... I can't start it!!I'm running SUSE Linux Enterprise Server 9, and in the shell - konsole window, I typed:mysqld startand that brings up the following: mysqld: Too many parametersmysqld Ver 3.23.49 for pc-linux-gnu on i686Use '--help' or '--no-defaults --help' for a list of available optionsSo then I tried:mysql -oand then I got:ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)I looked and 'mysql.sock' isn't even there! Other than that, everything works fine, Apache, PHP... it all works... I can view PHP pages fine over my network on my windows machine perfectly... I'm just having problems with MySQL since this is the first time I have ever tried this on a Linux system.Thanks for any help![N]F

Edited by microscopic^earthling (see edit history)

Share this post


Link to post
Share on other sites

You may already have MySQL installed before you installed another copy:

To find out if you have MySQL type ps -ax in the list of programs that appears look for one called mysqld

If MySQL is installed but not running then try typing this:

find / -name "mysql*" if a directory named mysql is found you have it installed! So you want to start it up

Change to the dirsctory mysql/bin

type safe_mysql &. then you should see a prompt.

The MySQL comes out of the box with root and no password so you can use that until you set up your own passord and username

Share this post


Link to post
Share on other sites

Hi, not sure if this is the correct spot but it is on MySQL which is database software! ;)

 

Ok, I am configuring a server for practice and I have run into problems with MySQL... I can't start it!!

 

I'm running SUSE Linux Enterprise Server 9, and in the shell - konsole window, I typed:

mysqld start

and that brings up the following:

mysqld: Too many parameters

mysqld Ver 3.23.49 for pc-linux-gnu on i686

Use '--help' or '--no-defaults --help' for a list of available options

 

So then I tried:

mysql -o

 

and then I got:

ERROR 2002: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

 

I looked and 'mysql.sock' isn't even there! Other than that, everything works fine, Apache, PHP... it all works... I can view PHP pages fine over my network on my windows machine perfectly... I'm just having problems with MySQL since this is the first time I have ever tried this on a Linux system.

 

Thanks for any help!

 

[N]F

1064328859[/snapback]


See if your mysql.sock doesn't exist - it means mysql server isn't running at all. Whenever the server runs, a .sock file will be created for sure. Even then, as houdini said, try doing a ps and make sure that it isn't running:

CONSOLE
shell> ps ax | grep mysql

8875 ? S 0:00 mysqld -u root

6384 pts/10 S 0:00 grep mysql

 

That will list any process with the name mysql as you can see above - if you don't see something like the first output line - it means your server isn't running.

 

To start your server you need to do the following:

CONSOLE
shell> mysqld -u root &

That should get the server started in background. Keep in mind, the space between, -u and root and don't miss out on the & sign.

 

Next step would be to connect to your server using the command line client:

CONSOLE

shell> mysql -u root -p

Enter Password:

At the enter password prompt, enter your root password - which you setup during installation. In case of linux, there's no initial root pass, so pressing enter would get you to the command line client.

 

You were basically using wrong parameters to start server/connect - hence your problems arose.

 

P.S. PHP & Apache will still run even if mysql isn't running.

 

Regards,

m^e

Share this post


Link to post
Share on other sites

To start your server you need to do the following:

CONSOLE
shell> mysqld -u root &

 

1064328867[/snapback]

Thanks m^e... I'm going to print this topic for future refrence but I ran into a problem when I ran the above. I'm going to quote what I typed, FYI, "linux" is the host name and I have no idea how to set that or anything but that is another topic! :P and the bold stuff is what I typed into the shell console

linux:~ # mysqld -u root &

[1] 22177

linux:~ # 051108  4:13:36  mysqld: Table 'mysql.host' doesn't exist

 


When I did a search for "mysql", I got a lot of results so I know MySQL is installed... I even have gone in through YaST and MySQL server and client are checked and installed. The shell command: find / -name "mysql*", brought up lots of directories... there's one in usr/bin, var/lock/subsys, var/lib, usr/lib, usr/sbin/mysqld (is this it? or something important?), usr/share, and some other sim. ones were in data1/usr/* (star just means the MySQL directories, not as many.)

 

All I know is that I got a new error and that is a good thing! At least I know I am making progress! ;)

 

If only I wasn't such a Linux noob!

 

[N]F

Share this post


Link to post
Share on other sites

mysqld: Table 'mysql.host' doesn't exist

I would say that this means that mysql has not been correctly installed.I suggest uninstall it properly, and then re-install it again.
Regards
Yordan

Share this post


Link to post
Share on other sites

Yay! I actually got somewhere... No Errors!! ;)

Ok, but I kind of need some help!

I typed in:
"mysqld -u root &"
I got:
"mysqld: ready for connections"
BUT, if you look at the display...

linux:~ # mysqld -u root &[1] 4217
linux:~ # mysqld: ready for connections
[]

the two brackets [] at the end there is where the cursor was.... as soon as I tried mysql -u root -p just like m^e said but it can't find the command "mysql"... well, at least I made SOME progress....

can anyone help me setup tables and stuff from the counsole or at least until I can get PHPMyAdmin installed?

Thanks!

[N]F

Share this post


Link to post
Share on other sites

One question - is this a new installation or did you install it over an earlier version ? If so you'll need to run some table/privilege fixing routines.

 

The error message table mysql.hosts doesn't exist clearly means that your installation was broken. All the tables under the database called mysql are created automatically with a basic set of rights - they are needed for normal functioning of mysql.

 

As for your installation directory - if you didn't specify any during installation, it would by default install into /usr/bin/ - that's where all the mysql executables reside.

 

Here's a list of the files that should be there:

-rwxr-xr-x  1 root root 2071116 Oct 22 02:46 myisamchk

-rwxr-xr-x  1 root root 1966000 Oct 22 02:46 myisam_ftdump

-rwxr-xr-x  1 root root 1974308 Oct 22 02:46 myisamlog

-rwxr-xr-x  1 root root 2001844 Oct 22 02:46 myisampack

-rwxr-xr-x  1 root root  751328 Oct 22 02:46 my_print_defaults

-rwxr-xr-x  1 root root 1943896 Oct 22 02:47 mysql

-rwxr-xr-x  1 root root  110667 Oct 22 02:47 mysqlaccess

-rwxr-xr-x  1 root root 1746000 Oct 22 02:47 mysqladmin

-rwxr-xr-x  1 root root    125 Dec 18  2004 mysql-administrator

-rwxr-xr-x  1 root root 6628756 Dec 18  2004 mysql-administrator-bin

-rwxr-xr-x  1 root root 1800200 Oct 22 02:47 mysqlbinlog

-rwxr-xr-x  1 root root  10347 Oct 22 02:47 mysqlbug

-rwxr-xr-x  1 root root 1741700 Oct 22 02:47 mysqlcheck

-rwxr-xr-x  1 root root 2015420 Oct 22 02:47 mysql_client_test

-rwxr-xr-x  1 root root    4551 Apr  3  2005 mysql_config

-rwxr-xr-x  1 root root    2977 Oct 22 02:47 mysql_convert_table_format

-rwxr-xr-x  1 root root  36201 Oct 22 02:47 mysql_create_system_tables

-rwxr-xr-x  1 root root  23188 Oct 22 02:47 mysqld_multi

-rwxr-xr-x  1 root root  12816 Oct 22 02:47 mysqld_safe

-rwxr-xr-x  1 root root 1777464 Oct 22 02:47 mysqldump

-rwxr-xr-x  1 root root    6160 Oct 22 02:47 mysqldumpslow

-rwxr-xr-x  1 root root  10419 Oct 22 02:47 mysql_explain_log

-rwxr-xr-x  1 root root    2653 Oct 22 02:47 mysql_find_rows

-rwxr-xr-x  1 root root    483 Oct 22 02:47 mysql_fix_extensions

-rwxr-xr-x  1 root root    5118 Oct 22 02:47 mysql_fix_privilege_tables

-rwxr-xr-x  1 root root  32790 Oct 22 02:47 mysqlhotcopy

-rwxr-xr-x  1 root root 1739024 Oct 22 02:47 mysqlimport

-rwxr-xr-x  1 root root    8693 Oct 22 02:47 mysql_install_db

-rwxr-xr-x  1 root root    129 Dec 19  2004 mysql-query-browser

-rwxr-xr-x  1 root root 7795516 Dec 19  2004 mysql-query-browser-bin

-rwxr-xr-x  1 root root    6308 Oct 22 02:47 mysql_secure_installation

-rwxr-xr-x  1 root root  17275 Oct 22 02:47 mysql_setpermission

-rwxr-xr-x  1 root root 1740196 Oct 22 02:47 mysqlshow

-rwxr-xr-x  1 root root  14476 Oct 22 02:47 mysql_tableinfo

-rwxr-xr-x  1 root root 1823904 Oct 22 02:47 mysqltest

-rwxr-xr-x  1 root root 1907128 Oct 22 02:47 mysqltestmanager

-rwxr-xr-x  1 root root 1732840 Oct 22 02:47 mysqltestmanagerc

-rwxr-xr-x  1 root root  580784 Oct 22 02:47 mysqltestmanager-pwgen

-rwxr-xr-x  1 root root  736600 Oct 22 02:47 mysql_tzinfo_to_sql

-rwxr-xr-x  1 root root  724496 Oct 22 02:46 mysql_waitpid

-rwxr-xr-x  1 root root    3118 Oct 22 02:47 mysql_zap

 


One thing that you can try without re-installing it is to run the command:

CONSOLE

shell> /usr/bin/mysql_install_db

And then

shell> /usr/bin/mysql_fix_privilege_tables

 

See if this helps. Otherwise it seems your installation got badly messed up and only solution is to uninstall all and reinstall using the RPM packages from their site.

 

Let me know how far you progressed.

 

Regards,

m^e

Share this post


Link to post
Share on other sites

Thanks for the tips m^e and everyone else.Since I work at my high school's IT department and we're setting up a local Intranet server, my "co-worker" (so to speak) told me about this thing called XAMPP and I downloaded it today. I accidently took off the Novell stuff on the server and had to get the Novell SUSE files back on. Once I got it back, I disabled Apache2 (took me a while to figure it out why XAMPP wasn't working ;) ) and got XAMPP fired up.I noticed when I unpackaged the tar.gz file was that it seems to be like PHPTriad for Windows (XAMPP also has a Windows version) because it included Apache, PHP, MySQL and a bunch of mods like Pearl and CGI. Now, using XAMPP, MySQL works! I don't know what the difference was between me trying to manually setup MySQL and XAMPP doing it, but XAMPP obviously did it the right way!I feel kind of bad for wasting your time, but I did learn a lot! I am a little more comfortable on my Linux server now! Thanks! You're all great! :P[N]F

Share this post


Link to post
Share on other sites

You're welcome. Like sometimes in real life, simply asking the question allowed you to get the problem solved, with help of a lucky strike. Let's be happy and celebrate this with you.

Share this post


Link to post
Share on other sites

Good that you got everything set ... but it'd still be fun to know WHY it was happening like that.. If you can still trace the problem, try writing back.

 

All the best,

m^e ;)

1064329621[/snapback]

lol, m^e, you just reminded me of my school's Internet service provider. (Sorry if this gets a little off topic) One day, the high school webmaster couldn't update the site from home and on Monday made a message on the homepage that for some reason the FTP account wouldn't work. He even had District Technology looking into it. It turns out that it was our provider (which, btw provides the worst web hosting services to member schools... one teacher had to drive out there just to make them put PHP on the server :P ). Now the provider in reply pretty much said something like "we don't know what we did or how to fix it." So our poor webmaster was given a new FTP account that works fine outside the provider's network.

 

Well, with MySQL, the only thing I can say is that the one that came with SuSE Linux Enterprise Server 9 must have installed wrong or some extra stuff needed wasn't included. But when I installed MySQL from a CD that came with an Apache 2 book (I always copy CD's from books because you never know when you're going to need them later on and not have access to the book at the library) it fixed the previous installation.

 

Now when I got the following:

inux:~ # mysqld -u root &

[1] 4217

linux:~ # mysqld: ready for connections

[]

 

That told me it was functional but I just didn't know any MySQL commands, enough for getting PHPMyAdmin setup which is how I create all databases. BUT, installing XAMPP for Linux which had everything also had PHPMyAdmin setup.

 

I guess I should learn some MySQL commands for the future, but thanks to you, m^e and everyone else, I would have probably been stuck with some other weird error!

 

[N]F

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.