MySQL error

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Hello again Smiling
I tried to get MySQL to install and work again, but it still wont.
It says that it "could not connect through mysql.sock" and the location is not correct. In fact, there is no mysql.sock anywhere on the filesystem.
Please help me out here, if you can.
Thanks!

Laughing out loud

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

What is giving that error? It sounds like you don't have the mySQL server runnng.

I had a similar error when trying to get AdminMod to use mySQL. It was looking for mysql.sock in the wrong place. I did a find or whereis and make a soft or symbolic link (what is it called? "ln -s") where it was looking, and it works like a charm.

Mark Hensler
If there is no answer on Google, then there is no question.

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Mysql wont start because of this error.
I did find/whereis and it can't find anything.
What does ln -s do??

Confusing...

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

When you say "Mysql wont start", do you mean the client (mysql) or the server (mysqld)?

By doing a "ln" you create a hard link. Meaning that you create another link to the same inode. By using the "-s" switch, you create a symbolic linke (I did a man). Symbolic links can span filesystems (partitions, and maybe networks). Just think of it as windows' "shortcuts".

What did your find command look like? I did this:

[max@host max]$ find / -name mysql.sock -print 2>/dev/null
/var/lib/mysql/mysql.sock
/tmp/mysql.sock
[max@host max]$
'I believe my original mysql.sock was in /tmp, and the AdminMod was looking in /var/lib. So, would have I executed this command:
[max@host max]$ ln -s /tmp/mysql.sock /var/lib/mysql.sock
'Now, anytime AdminMod looks at /var/lib/mysql.sock, it's really looking at /tmp/mysql.sock. Even though it doesn't know it.

If there are any community colleges or adult schools around you, check to see if they have any *nix classes. I'm in the second of four classes. Very fun! Learning lots!

Mark Hensler
If there is no answer on Google, then there is no question.

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Should mysql.sock be an empty file?
Mysqld wont start because of this error:

Quote:
can't find file: './mysql/host.frm' errno 13

If I run safe_mysqld I get this:

Quote:
Starting mysqld daemon with databases from /var/lib/mysql
MySQL ended.

I've tried searching google and altavista for answers, but I couldn't find anything that worked.
I dont have a file mysql.sock anywhere that is not an empty file.
Thanks

Laughing out loud

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Try this:
Look in your /tmp directory.
Delete any instance of mysql.sock that is there.
Make sure that whatever user that you are connecting to mysql with, is able to write to the /tmp directory. If not
chmod -644 /tmp

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

I figured it out! At least getting mysqld to start.
I had to chmod 777 host.frm
Now I can't connect to the server from a PHP file.
How do I add a new user and password?
Thanks!

Laughing out loud

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

As a general rule, chmod'ing -777 is not a good idea. -644 probably would do the trick.

For more info on users and passwords:
http://www.mysql.com/doc/A/d/Adding_users.html

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Ok... Now when I do mysql it tells me

Quote:
Error 1045: Access denied for user root@localhost (Using Password: NO)

Why is 777 not a good idea?

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

777 on a local machine is not all that bad but it is a bad habit to get into. Basically you are giving anyone read/write/execute permission. This is never a good idea.

Okay, how are you trying to login to MySQL. Like this:
mysql

If so what user, in Linux, are you logged in as. Generally you would login to MySQL as:
mysql -u username -ppassword

Notice the space between -u and username but no space between -p and password. You can also specify the host with -h localhost, but this is the default.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Hmmm.. I reset the machine, and came back to the command line.
It is giving me an error when running startx.
It says that it cannot load the default font, fixed.
And X won't start.
I can't get into X, I can't work with mysql that easily.
Thank you!

Laughing out loud

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Quote: Originally posted by nike_guy_man
Hmmm.. I reset the machine, and came back to the command line.
It is giving me an error when running [b]startx
.
It says that it cannot load the default font, fixed.
And X won't start.
[/B]

Try running startx --help

Quote: Originally posted by nike_guy_man
[B
I can't get into X, I can't work with mysql that easily.
Thank you!

Sure you can. It's too easy once you get the hang of it. Plus you learn sql better than using an interface.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Command line is the way to go. I have Mandrake 8.0 installed with all the GUI goodies. But the box is in the other room with no monitor.

This is actually a great arangement. Realistically, I'll almost never get to use the GUI on a job. So I get to use SSH to do/learn everything on my box, and when I get stuck, I can yank a monitor outa the garage and use the GUI.

Mark Hensler
If there is no answer on Google, then there is no question.

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

A GUI in Linux? Every time I start X up, I've got to find a mouse to use. I only use it then to maybe see if a web page looks different in Linux/NS.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I've used it mainly to tweak network settings. I've yet to learn how to do that from the terminal.

Right now, my linux box has a static IP (192.168.1.20), while everything else on the network is using the DHCP server in my router. That way, if I have to bounce the box, I don't have to change my port forwarding settings. And when I host LAN parties, I don't have to assign IPs to everyone (DHCP does that).

Mark Hensler
If there is no answer on Google, then there is no question.

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

When I run mysqld the machine hangs. In X I can close the terminal window.
I work with MySQL through a terminal window usually.
I am connecting through my windows machine using an SSH client, now just for working with it.
It gives me the same error, that access was denied for root@localhost or whatever user I try.
Please help!!

Laughing out loud

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Why would you be running mysqld?

To start mysql, go to
mysql_directory/scripts/
and type in
./safe_mysqld &

Has a password been assigned to mysql?
Try at the typing in at the prompt:
mysql.
Can you connect?

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Have you read the docs? Maybe these will help:
2.4 Post-installation Setup and Testing
2.4.2 Problems Starting the MySQL Server
4.3.4 Setting Up the Initial MySQL Privileges (like giving root a password)

Mark Hensler
If there is no answer on Google, then there is no question.

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Mairving: Still cannot connect using a user.
I can, however, connect using mysql -u mysql but then when I try the commands from the MySQL Manual pages that Mark suggested, It tells me that I dont have access to database mysql
?

Laughing out loud

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

You actually are connecting to mysql as a user since mysql is a user, with not many priviledges.

What happens when you try to connect as mysql -u root?

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

mysql -u root returns this:
Error 1045: Access denied for user root@localhost (Using Password=NO)

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Ok I went to the MySQL site and ran through the setup again, and I can now connect, and create a database with PHP
But I can't create a table in that database.
And there are no errors saying why.
Should I ask this in the Database forum or keep it here?

Laughing out loud

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

I think this is fine. The title is "MySQL error" after all.

Check the permissions for the user you are using. Make sure they have "create" permissions for that DB.

Mark Hensler
If there is no answer on Google, then there is no question.

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

What are create permissions?

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

Permissions define what a person can or can't do in MySQL. If this is your server at home, not on the Internet, I don't know if I would bother setting up other users and permissions.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

I know what permissions are, but Mark said they were "create" permissions.
What are they? 755?
This is my home server

mairving's picture

They have: 2,256 posts

Joined: Feb 2001

MySQL generally calls them priviledges, not permissions. Same thing though. Each user can be granted certain priviledges. Priviledges to create, drop, insert, update, select, etc. Root has full priviledges.

Mark Irving
I have a mind like a steel trap; it is rusty and illegal in 47 states

nike_guy_man's picture

They have: 840 posts

Joined: Sep 2000

Ok, so why wont it create a new table and insert values into it?
I get no error when trying to insert it.
It inserts nothing and tells me that it was unsuccessful.

Laughing out loud

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

privileges/permissions.. hey, they both start with a P!

are you still using the terminal?
can you get phpMyAdmin in? I really like 2.2.1! I had hacked 2.2.0 to display the user logged in, but they added that in 2.2.1. Way kuel! Very nice admin thing added in version 2 to manage users.

Also, anytime you alter privileges, you need to FLUSH PRIVILEGES before they take effect.

What queries are you runnnig for CREATE/INSERT?
And your doing these as root, right?
Which DB are you inserting into?

Mark Hensler
If there is no answer on Google, then there is no question.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.