davy_yg's avatar
Level 27

Install phpmyadmin on linux

Hello,

I am trying to install phpmyadmin on linux:

ref: https://www.ostechnix.com/install-phpmyadmin-with-lamp-stack-on-ubuntu-18-04-lts/

I get stuck on :

$ mysql -u root -p

davy@davy-Aspire-E5-476G:~$ mysql -u root -p Enter password: ERROR 1698 (28000): Access denied for user 'root'@'localhost'

I cannot remember setting any password for it.

This also does not work:

ref: https://tableplus.com/blog/2018/11/what-is-the-default-username-password-in-mysql.html

davy@davy-Aspire-E5-476Gdavy@davy-Aspire-E5-476G:~$ sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
davy@davy-Aspire-E5-476G:~$ sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
[1] 22752

davy@davy-Aspire-E5-476G:~$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld /mysqld.sock' (2)
[1]+  Exit 1                  sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking
:~$ sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
davy@davy-Aspire-E5-476G:~$ sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
[1] 22752
davy@davy-Aspire-E5-476G:~$ sudo /etc/init.d/mysql stop
[ ok ] Stopping mysql (via systemctl): mysql.service.
davy@davy-Aspire-E5-476G:~$ sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
[1] 22752
davy@davy-Aspire-E5-476G:~$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
[1]+  Exit 1                  sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking

davy@davy-Aspire-E5-476G:~$ mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
[1]+  Exit 1                  sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking

Any clue what to do?

0 likes
25 replies
fylzero's avatar

@davy_yg It looks like you stopped the mysql service then tried accessing mysql.

Probably try restarting mysql.

davy_yg's avatar
Level 27

davy@davy-Aspire-E5-476G:~$ sudo /etc/init.d/mysql start [ ok ] Starting mysql (via systemctl): mysql.service. davy@davy-Aspire-E5-476G:~$ mysql -u root ERROR 1698 (28000): Access denied for user 'root'@'localhost'

I don't know the password. I don't remember setting it up.

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

Try this command with sudo

sudo mysql -u root
Sinnbeck's avatar

Remove user and try again

DROP USER 'phpmyadminuser'@'localhost';
Sinnbeck's avatar

I am curious BTW. Any reason to choose phpmyadmin, instead of an installable database manager like dbeaver or heidisql?

davy_yg's avatar
Level 27

This is what I did:

'> DROP USER 'phpmyadminuser'@'localhost';
    '> 
    '> CREATE USER 'phpmyadminuser'@'localhost' IDENTIFIED BY 'password';
    '> exit
    '> exit();
    '> 

How to exit from mysql> ?

I thought having phpmyadmin is a must to manage the database, just like in windows xampp. heidisql only an addition or helping tools.

Sinnbeck's avatar

It is just a manager that can be used over the internet (therefor popular for hosting providers). As your database is local, you don't need to manage via a website.

Type exit

Randy_Johnson's avatar

Install xampp is come in the package. Uninstall any previous apps that will conflict.

davy_yg's avatar
Level 27

the php file info.php already works. but I want to see the database management. I normally use phpmyadmin xampp in Windows. What about in Linux lampp ? I think they should have phpmyadmin works in lampp ?

Sinnbeck's avatar

It is not part of the stack as there are many database managers and you are free to choose the one you want. Personally I use dbeaver on Linux as it works with all kinds of databases

davy_yg's avatar
Level 27

which database manager would you recommend for lampp? I am having a difficult time installing phpmyadmin in lampp.

Sinnbeck's avatar

@armancodes mentioned a few. Personally I prefer dbeaver. Be aware. Table plus is only alpha for Linux as far as I know

Sinnbeck's avatar

Just run this command

sudo snap install dbeaver-ce
davy_yg's avatar
Level 27

I created a sample database and get this message:

Access denied for user 'root'@'localhost'

Sinnbeck's avatar

Yeah you need to logon using the user you created. Remember that you cannot login using root without being sudo :)

davy_yg's avatar
Level 27

I open the beaver software by clicking it in software menu.

Then, I try to become sudo in terminal:

davy@davy-Aspire-E5-476G:~$ su - Password: su: Authentication failure

Yet, I have an authentication failure. Any clue why? I don't know my root password.

Sinnbeck's avatar

Don't change your user to root. Create a new user that you want to use for stuff using the procedure you covered yourself earlier. Then use that user to login to dbeaver :)

Cronix's avatar

Why do you need to install any of this on the server?

Just install on your local system (phpmyadmin, navicat, sequel pro, whatever) and add a remote database (your server) to connect to. Keep it on your mac or windows or whatever you're using and leave the actual server alone. Just manage it remotely.

You can manage all of your remote mysql instances on all of your various servers from the same local interface.

davy_yg's avatar
Level 27

I get this message:

https://drive.google.com/file/d/1GghVeeiupEfHZ1XL3APKbPUTPan5J7Ih/view?usp=sharing

This is all in my laptop localhost. I have dual os - linux and windows. Now, I am using linux. I can switch to windows anytime.

Can you not use root as the user and nothing as the password?

I tested creating a new database with usertest as the username and has a password. It is also :

Access denied for user 'usertest'@'localhost' (using password: YES)

I wonder if this dbeaver software is connecting to phpmyadmin so that whenever the username and password is not the same then an access denied message appears?

Sinnbeck's avatar

Again.. phpmyadmin is a database management tool.. Not the actual database. DBeaver connects to your database directly.

Anyways. Right click the connection and select Edit connection. Now change the User name and Password fields https://imgur.com/mAiT1z2

davy_yg's avatar
Level 27

The default is username: root and password: root

correct?

Also, I cannot find the edit connection option. Where to find this option?

Please or to participate in this conversation.