Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: MySQL socket change for 11.2

  1. #1
    Join Date
    May 2010
    Location
    Central USA
    Posts
    229

    Default MySQL socket change for 11.2

    I'm relatively new but have just now made the upgrade from 11.1 to 11.2. In looking at the release notes, I saw the comment

    File locations changes:

    * MySQL socket file and pid file were moved from /var/lib/mysql to more reasonable location /var/run/mysql by default.
    * MySQL log files are in /var/log/mysql.

    Not sure what I was supposed to do with that information. So I ignored it. Now, I am finding some issues with it. The web server works, but any connection to the database fails with
    2002: Can't connect to local MySQL server through socket '/var/run/mysql/mysql.sock' (2)

    The thought dawned on me that maybe all my databases were erased and none set up. Going in to the terminal, I could connect and list and query the databases. So even though I backed them up, they still are there!

    phpMyAdmin gives the same error message.

    However, when I go into MySQL Administrator, it works fine.

    I forgot where I saw it, but the socket is still set to var/lib/mysql. I could not find any mysql install log and would say what was in my cnf.my, but it still doesn't exist just as it has not in the past. Not sure if I should allow the MySQL Administrator to create it since I always ignored the prompt in the past and it worked. (Just wishing to keep the defaults)

    At first I thought the upgrade upgraded the MySQL, but it's still 5.1.39 as I believe before. I've un-installed mysql-server and re-installed it with no change.

    Can anyone can tell me how to get the socket to /var/run/mysql or what else is wrong? I read one place where mysql is supposed to set it up.

    Thanks.

  2. #2
    Join Date
    Jun 2008
    Location
    Groningen, Netherlands
    Posts
    17,153
    Blog Entries
    13

    Default Re: MySQL socket change for 11.2

    In /etc/my.cnf (and not cnf.my ) it says:
    Code:
    socket          = /var/run/mysql/mysql.sock
    This comes from my working 11.2 webserver.
    ° Appreciate my reply? Click the star and let me kow why.

    ° Perfection is not gonna happen. No way.

    http://en.opensuse.org/User:Knurpht
    http://nl.opensuse.org/Gebruiker:Knurpht

  3. #3
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,936
    Blog Entries
    4

    Default Re: MySQL socket change for 11.2

    @OP: You may have edited that file or your local file ~/.my.cnf and changed the default location, which the libraries depend on. I would suggest letting it default to the location /var/run/mysql/mysql.sock.

  4. #4
    Join Date
    May 2010
    Location
    Central USA
    Posts
    229

    Default Re: MySQL socket change for 11.2

    Sorry, I may be dyslexic, too! I searched for both in /etc and could find neither. I even had searched for contents in /etc for "mysql.sock" and found sysconfig/postfix
    # Set this to yes, if SuSEconfig should setup 'mysql.sock' inside chroot jail
    # Note: You should set this to yes if you did POSTFIX_CHROOT="yes" and
    #
    POSTFIX_WITH_MYSQL="no"
    and in apparmor.d/abstractions/mysql
    /var/lib/mysql/mysql.sock rw,
    /usr/share/mysql/charsets/ r,
    /usr/share/mysql/charsets/*.xml r,

    Neither seems relevant to me. But then, I'm not sure what apparmor really does. Any other ideas where it's getting the default if my.cnf doesn't exist?

    With further searching I have come across someone else with a similar problem:
    Re: [opensuse] Build Service Update to mysql-5.1.34-29.1 on 10.3 has wr
    My /usr/sbin/rcmysql (with 2009 date) has
    if test -z "$datadir"
    then
    datadir=/var/lib/mysql
    fi
    but does not have the socket line. It makes reference to /etc/my.cnf. How is the best way to create it? But even more so, how should I get mysql.sock file in the /var/run/mysql (doesn't exist) instead of the /var/lib/mysql directory since even if I had a my.cnf, it wouldn't point to anything that exist unless I point it to the old /var/lib/mysql. (Not sure I understand what a socket does nor how it's created. From socket =?)

    I also saw something about libmysqlclient16 and 15. I have both. Think that could be an issue and if I upgrade mysql-gui-tools I can get rid of 15 and maybe it will work? It's many megabytes so will have to wait until I can go someplace to download it.

    By the way, I had to build the kernel to get my ATI graphics to work. Think that has to do with anything?

  5. #5
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,936
    Blog Entries
    4

    Default Re: MySQL socket change for 11.2

    It looks like your update wasn't thorough enough because the 11.2 mysql package does contain the directory /var/run/mysql. Or perhaps you have a mix of the old and new packages. I guess this is one of the hazards of an incremental update.

    You could just create it and restart mysql and see what happens.

    Code:
    mkdir /var/run/mysql
    chown mysql:mysql /var/run/mysql

  6. #6
    Join Date
    May 2010
    Location
    Central USA
    Posts
    229

    Default Re: MySQL socket change for 11.2

    Ok, I tried creating the directory and no change.
    phpMyAdmin gives this explanation of the error:
    #2002 - The server is not responding (or the local MySQL server's socket is not correctly configured)
    Which makes sense since the error message from php says it can't open it at /var/run/mysql so no socket exists.

    How does the socket come into being?

    I have uninstalled and reinstalled mysql gui tools and loaded the share instead of the share-compat to make sure the libmysqlclient15 is no longer there. Rebooted, and no difference.

    The MySQLAdministrator gives much information, but I don't know what to look for. It is using /var/lib/mysql/mysql.sock.
    (Hmmmm....)

    Looking at mysqld --help --verbose shows that the socket is /var/lib/mysql/mysql.sock (which we already knew).

    Looking at /var/lib/mysql/(server).err shows
    [Note] Plugin 'FEDERATED' is disabled.
    InnoDB: Started; log sequence number 0 44323
    [Note] Event Scheduler: Loaded 0 events
    [Note] /usr/sbin/mysqld: ready for connections.
    Version: '5.1.39' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)

    Hmmm.... Everything seems to work that is using the /var/lib/mysql/mysql.sock but some programs don't work that use /var/run/mysql. Those two programs that I'm trying to use both are PHP programs. Looking at /etc/php5/php.ini has
    ; Default socket name for local MySQL connects. If empty, uses the built-in
    ; MySQL defaults.
    mysqli.default_socket =
    Built in? As in my issue is maybe with php? It's 5.3. So, somehow it was using /var/lib, but now is using /var/run. How does it know that? Something is telling it to use 11.2's /var/run. It's hard to do a system search for where it's set when you realize it could be something like $datadir/mysql.sock.

    Should I try to make the system "built in" to point to /var/lib or the other programs point to /var/run? Don't want to create more issues. Maybe if I create a my.cnf file and say socket = /var/lib/mysql/mysql.sock will fix it and any other issues? Or set php.ini to socket=..../var/lib/mysql/mysql.sock (or what?). What is best?

  7. #7
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,936
    Blog Entries
    4

    Default Re: MySQL socket change for 11.2

    The directory that will contain the socket must exist and then the server creates the socket when it starts listening on it. The directory is contained in the mysql package for 11.2.

    You should stick to the standard location specified by the 11.2 version of mysql and any associated libraries, which will be looking there for the socket.

    It seems that you have a mix of 11.1 and 11.2 conventions on your machine, possibly because /etc/my.cnf wasn't updated. Look to see if there is an /etc/my.cnf.rpmnew, which is the standard my.cnf from 11.2 which was not installed due to an existing /etc/my.cnf from 11.1.

  8. #8
    Join Date
    May 2010
    Location
    Central USA
    Posts
    229

    Default Re: MySQL socket change for 11.2

    I searched the whole file system for "my.cnf*" and I did find some something like my-small.cnf, my-large.cnf samples. When I look in the YAST installer, it showed in the file list a /etc/my.cnf but it's not there. (Logging in as su in Konsole, cd /etc, ls my* shows no files)

    Needing to get something to work, I modified php.ini to have socket=/var/lib/mysql/mysql.sock and everything works lovely. So unless someone can tell me where it's setting the default to be /var/run/mysql and/or the proper way for setting things up, I guess I'll go with this.

    I don't know if it's because of me upgrading instead of installing fresh or my particular setup. I can't believe I'm the only one. Rather than saying, hey, I got my problem working (even if not proper) let's forget about it, it would be nice to know why, what happened, and how to fix it for the future. The upgrade put me behind my initial install in some ways and I've seen others complain. I'm afraid some would give up completely. Even I have considered giving up several times over this past year, but then I consider Microsoft, and go back to trying a little harder. Eventually I get some things working and move on, then forget about it. I think a lot of dedicated computer type people do it similarly. However, if Linux is ever going to be something the masses can use, there's got to be a better way.

    For example, just setting the time was a very burdensome and painful ordeal. Eventually, I did some order of combination of setting it in two different places and it stayed after rebooting. Then the upgrade messed it up again. After several days of it changing back after rebooting, I finally got it to stay. Not sure what I did, though. But that's another topic, but demonstrates that there are some things wrong or at least can be made better. The average user doesn't run a web server with mysql, but there are enough people out there who would give up with this much trouble.

    Perhaps upgrading is not the right way. Installing the new system version parallel and then switching over may be better. Not sure how that would work with getting all the software installs over to the new. In fact, just for curiosity I would install separately to see if the /etc/my.cnf would appear but not sure how to set up the partitions for such parallel system. I might try to insert another drive, though small, and try it.

  9. #9
    Join Date
    Jun 2008
    Location
    UTC+10
    Posts
    9,936
    Blog Entries
    4

    Default Re: MySQL socket change for 11.2

    I suspect the upgrade from 11.1 to 11.2 didn't go cleanly, at least for you. It's not good that there is no /etc/my.cnf, it means something from the package was not installed. Let's hope that any security updates to mysql don't upset the status quo for you.

  10. #10
    Join Date
    Nov 2008
    Location
    Northern VA
    Posts
    272

    Default Re: MySQL socket change for 11.2

    Quote Originally Posted by Knurpht View Post
    In /etc/my.cnf (and not cnf.my ) it says:
    Code:
    socket          = /var/run/mysql/mysql.sock
    This comes from my working 11.2 webserver.
    Got Apache 2 running on oS 11.2, but have similar problems with mySQL, ver. 5.1.47 (replacing an earlier attempt with 5.1.42). Yast's file list for mysql-community-server puts my.cnf in /etc (and it is there), but there is no file /etc/my.cnf.rpmnew shown nor is there an existing directory or file called /var/run/mysql to match the entry in Yast's file list.

    As a possible indicator: at no time during the several installations of mySQL have I seen an opportunity to create the root user in mySQL or to assign that user a password. Thus I can't reach the mySQL server from phpMyAdmin on another machine (oS 11.1).

Page 1 of 3 123 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •