5

I am new to ubuntu and installed MySQL use a rpm file, and started it use sudo start mysql, when i try

mysqladmin -u root password test

I get

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 checked the mysqld folder and there is nothing
what can i do the next? Thanks for your answers

1

6 Answers 6

5

first do

 sudo mysql_install_db

 sudo mysql_secure_installation

 mysql -u root -p

then enter your password

1
  • when i try sudo mysql_install_db it says Installing MySQL system tables... /usr/sbin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
    – yang
    Nov 19, 2011 at 5:32
4

Ubuntu doesnot use rpm it uses deb. Make sure you have installed mysql i.e.

sudo apt-get install mysql-server

It will prompt for password for root user i.e. password for your mysql root user not your system root user.

After that do

mysql -u root -p

you will be prompted for password and enter your mysql root password one you entered during mysql installation and then you are good to go.

2

How did you manage to install it using an rpm file??? I'm sure that you're either mistaken or definitely doing something wrong. All you needed to do is

sudo apt-get install mysql-server mysql-client

UPDATE: There seems to be MySQL 5.5 .deb file here (although the repository is for Debian) - at any rate, I think it may work better than an rpm

2
  • yeah,I've installed use the sudo apt-get install mysql-server mysql-client before, but the MySQL version is 5.1 but I want to install 5.5,so I used alien to convert the rpm file to deb file,then i use sudo dpkg -i mysql-server.deb to install it,and now I google a lot but I just didn't find an answer to solve my problem
    – yang
    Nov 18, 2011 at 8:00
  • If you were following something similar to these instructions - smilecouple.org/2011/07/25/how-to-install-mysql-5-5-on-ubuntu - note the use of /usr/bin/mysql_secure_installation at the end
    – Sergey
    Nov 18, 2011 at 11:16
0

There's some information in the MySQL Documentation regarding connection errors. AFAIK you will have to enable access even on localhost by modifying the bind-address config parameter: You will have to set it explicitly to 127.0.0.1 to make MySQL waiting for localhost connections. There config file should be /etc/mysql/my.conf or /etc/mysql/my.cnf

0

Read up on 'auth_socket'. I moved from another Linux to Ubuntu and burned a day and a half on this.

can't login as mysql user root from normal user account in ubuntu 16.04

0

I need to run sudo mysqladmin -u root password test to connect after doing the same steps you did, on ubuntu 18.04.

All the files under /var/lib/mysql are owned by mysql:mysql, except debian-5.7.flag which is owned by root.

I don't like this though. Could someone point out if this is harmless or how to fix it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.