-   Linux - Newbie (
-   -   Major frustration: Can't get MySql installed and working (

jim.thornton 09-21-2012 04:45 PM

Major frustration: Can't get MySql installed and working
Ubuntu 12.04 LTS
384MB Ram
Burstable 1GB
VPS => OpenVZ

I have been searching and searching for the solutions to this but have hit a dead end. It seems to be one problem after another. I'm trying to setup a server ISPConfig 3 and during the installation it said that MySQL was not installed. I was surprised because everything that I have read said that it was installed by default with U 12.04.

I used apt-get to install mysql-server mysql-common mysql-client and it went through everything. A page popped up wanting to set the root password and that kept failing. Finally, I purged everything mysql and started over. I re-installed and this time after the error I ran $ mysql_install_db and that resulted in the following output:

Installing MySQL system tables...
Filling help tables...

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

To do so, start the server, then issue the following commands:

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h vpsgrid password 'new-password'

Alternatively you can run:

which will also give you the option of removing the test
databases and anonymous user created by default.  This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with
cd /usr/mysql-test ; perl

Please report any problems with the /usr/scripts/mysqlbug script!

I then tried to reset the password via the commandline which resulted in the following output:

sudo /usr/bin/mysqladmin -u root password passwordhere
/usr/bin/mysqladmin: connect to server at 'localhost' failed
error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!

I then ran $ sudo mysql_secure_installation which resulted in the following output:

sudo mysql_secure_installation
touch: cannot touch `.my.cnf.4676': No such file or directory
touch: cannot touch `.mysql.4676': No such file or directory
chmod: cannot access `.my.cnf.4676': No such file or directory
chmod: cannot access `.mysql.4676': No such file or directory


In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
/usr/bin/mysql_secure_installation: 85: /usr/bin/mysql_secure_installation: cannot create .my.cnf.4676: Directory nonexistent
/usr/bin/mysql_secure_installation: 86: /usr/bin/mysql_secure_installation: cannot create .my.cnf.4676: Directory nonexistent
/usr/bin/mysql_secure_installation: 87: /usr/bin/mysql_secure_installation: cannot create .my.cnf.4676: Directory nonexistent
/usr/bin/mysql_secure_installation: 89: /usr/bin/mysql_secure_installation: cannot create .my.cnf.4676: Directory nonexistent
/usr/bin/mysql_secure_installation: 58: /usr/bin/mysql_secure_installation: cannot create .mysql.4676: Directory nonexistent
/usr/bin/mysql_secure_installation: 60: /usr/bin/mysql_secure_installation: cannot open .mysql.4676: No such file
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:
Re-enter new password:
/usr/bin/mysql_secure_installation: 58: /usr/bin/mysql_secure_installation: cannot create .mysql.4676: Directory nonexistent
/usr/bin/mysql_secure_installation: 60: /usr/bin/mysql_secure_installation: cannot open .mysql.4676: No such file
Password update failed!

Can someone please help me. It seems like one problem after another after another after another.... You get the picture.

cpasqualini 09-21-2012 06:52 PM

i don't understand what goes wrong in your install, because normally it's a really simple task to get mysql running on a debian/ubuntu installation.

as i can see you had run

$ mysql_install_db
but that $ makes me think that you had run that command without root permissions (without sudo).

i'm more a Debian admnistrator than ubuntu one, so normally i execute

sudo su -
and get a root shell.

for installing mysql you just need to run (as root):

apt-get install mysql-server
it will take automatically all the dependencies, including mysql-client.

if you have it already installed you can try (as root):

dpkg-reconfigure mysql-server
if that doesn't show you any debconf interface, can be because mysql-server it's a meta-package depending on the real mysql-server that have been installed. As an example, on an old ubuntu 10.10 machine i have running:

$ dpkg-query -l |grep mysql-server
ii  mysql-server                                        5.1.61-0ubuntu0.10.10.1                                  MySQL database server (metapackage depending on the latest version)
ii  mysql-server-5.1                                    5.1.61-0ubuntu0.10.10.1                                  MySQL database server binaries and system database setup
ii  mysql-server-core-5.1                                5.1.61-0ubuntu0.10.10.1                                  MySQL database server binaries
$ sudo dpkg-reconfigure mysql-server-5.1
[dialog screen asking for mysql's root password (twice)]
mysql stop/waiting
mysql start/running, process 18003
$ ps ax|grep mysql
18003 ?        Ssl    0:00 /usr/sbin/mysqld
18040 pts/2    S+    0:00 grep --color=auto mysql

please note that i had run those command with local user permissions and not on root's shell

in debian, you need to do the Debian way, the original package way not work every time..

besides that, i have found an affirmation that you must confirm: MySql will only install if you have a NON-NUMERIC hostname that is resolvable via the /etc/host file

please try that commands an dump here some more info

best regards

jim.thornton 09-22-2012 12:20 AM

Thank you for pointing me in that direction. After reading your post I started working on other things and I started searching for other terms with regards to other errors I was getting.

FYI: It all came down to InnoDB was failing to start. I added the following two lines to my.cnf under the [mysqld] section and it started right up:

default_storage_engine = MyISAM

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