Hello,

I have tried to install mysql in linux and it said that I already installed it. Then the problem is I do not know the password to enter it. What should I do?

davy@ubuntu:~$ mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
davy@ubuntu:~$

If I have to reinstall mysql in linux how?

Thanks before.

Dani AI

Generated

Quick summary for : don’t reinstall yet — try recovering the root account first, because reinstalling and removing the data directory will permanently delete your databases unless you back them up.

If you need to change the forgotten root password, the official MySQL procedures show two safe approaches (Windows uses an init file; Unix/Linux guidance covers starting the server in a special mode so you can set a new password). After changing the password you must flush privileges and restart the server. Example (run inside a MySQL session once you’re connected in recovery mode):

ALTER USER 'root'@'localhost' IDENTIFIED BY 'YourNewStrongPassword';
FLUSH PRIVILEGES;

See the MySQL reference for the full, version-aware procedures. (dev.mysql.com)

Before doing that, check whether your installation is using socket-based authentication: Debian/Ubuntu packages often set the root account to authenticate via the auth_socket / unix_socket plugin. In that case mysql -u root -p will fail even with the correct password, but connecting as the system root (for example with sudo mysql) lets you in; from there you can either create an administrative user or change the root account to password authentication. The auth_socket behavior and how to change it are documented in the MySQL docs. ()

If you still want to reinstall: use the package tools to purge the server package (that removes binaries and configs) but be explicit about the data directory — many uninstall flows will also remove /var/lib/mysql if you confirm it. Back up /var/lib/mysql (or dump databases with mysqldump) before deleting anything. The apt/apt-get “purge” semantics and the MySQL uninstall notes explain the risks. Also, regarding your openmeetings tarball: some archives do not create a top-level folder — list the archive contents first to check (for example with tar’s list option) or extract into an empty directory. For archive inspection and safe extraction see the tar documentation. (help.ubuntu.com)

Notes tied to the thread: ’s Ubuntu guide is a good starting point; ’s dtrx recommendation and ’s GUI extraction reminder are both useful if you prefer a higher-level tool or desktop extraction — just be sure to confirm which MySQL instance you’re talking to (system package vs XAMPP) before wiping anything.

Hmm.. I think this is the syntax:

apt-get purge mysql-server mysql-common mysql-client-<version>
rm -rf /var/lib/mysql
rm -rf /etc/mysql*

--------------------------

davy@ubuntu:~$ ls
core       Downloads         Pictures   Videos
Desktop    examples.desktop  Public
Documents  Music             Templates

--------------------------

Yet, I cannot find where mysql file localted?

Another question: how to unzip file in linux:

davy@ubuntu:~/Desktop/openmeetings$ tar zfx apache-openmeetings-3.0.0.tar.gz
davy@ubuntu:~/Desktop/openmeetings$ ls

admin.bat
admin.sh
apache-openmeetings-3.0.0-src.zip
apache-openmeetings-3.0.0.tar.gz
apache-openmeetings-3.0.0.zip
boot.jar
CHANGELOG
commons-cli-jar-1.2.jar
conf
flashplayer_11_plugin_debug.i386.tar.gz
flashplayer_11_sa_debug.i386.tar.gz
flashplayer_11_sa.i386.tar.gz
ghostscript-9.10-linux-x86_64
ghostscript-9.10-linux-x86_64.tgz
ImageMagick-6.8.8-8
ImageMagick-6.8.8-8.zip
jodconverter-core-3.0-beta-4-dist.zip
lib
LibreOffice_4.2.2.1_Linux_x86-64_rpm
LibreOffice_4.2.2_Linux_x86-64_rpm.tar.gz
LibreOffice_4.2.2_Win_x86_helppack_en-US.msi
LICENSE
log
network_test.sh
NOTICE
Players
plugins
README
red5.bat
red5-debug.bat
red5-debug.sh
red5-highperf.bat
red5-highperf.sh
red5.jar
red5-license.txt
red5.sh
red5-shutdown.bat
red5-shutdown.sh
sox-14.4.1-win32.exe
swftools-0.9.2
swftools-0.9.2.tar.gz
webapps
xampp-linux-x64-1.8.3-3-installer.run
davy@ubuntu:~/Desktop/openmeetings$

I thought, I suppose to have apache-openmeetings-3.0.0/ folder in Desktop/openmeetings after unziping the apache-openmeetings-3.0.0.tar.gz file.

Yet, I cannot find it.

Member Avatar for Member #1102190

file_path tar xzf file.tar.gz -C destination_path

try the above command.
Firstly give the file path of the .tar.gz that needs to be extracted.
Then at the end writr the location where u need the .tar.gz to be extracted.

I know this has already been solved. But as an addendum:
If you use a lot of different compressed formats(.7z, .zip, .tar.gz, .rar, .ace) and you want to be able to extract them on the command line, but without having to remember all of the different command line switches and options for each format; there is a nifty little python script called dtrx (Do The Right Extraction).
Extracting archives is then just a case of:
dtrx archivename.tar.gz or .7z, or .zip or whatever!

dtrx is available from the Ubuntu repos:
sudo apt-get install dtrx

Note: in order for dtrx to work with different archive types, you'll need to ensure that you have the appropriate programs installed for those file-types. So it will not extract .7z files if you do not have 7zip installed. As long as you have whatever programs you need installed, dtrx will deal with extracting the archives appropriately!

Member Avatar for Member #46692

You should just be able to right click the zip file and choose extract, unless it is in an odd format.

You should just be able to right click the zip file and choose extract, unless it is in an odd format.

True - That would work on the desktop, or in a file-manager like Nautilus or Dolphin.

But on the command line, I heartily recommend dtrx. Especially if you use the command line often and you have a lot of compressed archives in several different file-formats.

It saves you from having to remember all of the command-line switches for all of the different decompression programs. It also saves you from having to trawl the man-pages for the appropriate switches when you forget them. Simply leave it to dtrx to handle all of that for you!

Member Avatar for Member #46692

^^Very true. I believe anyone using linux should be familiar with the command line... but why use it when you can use the deskop.

The OP has mentioned ssh'ing into a virtual machine and doing these changes... OK that might be a reason to use the command line but don't forget you can install something like tightVNC server and access it via a gui shell.

Something to chew on no doubt.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.