Mysql Wipe out all

Dear all,
I have not used my mysql for years. I do not remember any user associated with it or any database that I created inside it (no worries I do not need anything).

I want to wipe out everything and start from the point like just having made the installation. 1.How I can wipe out all users and databases inside it (I have root permissions ofc)
2. How then I can add a new mysql user?

I would like to thank you in advance for your help


show databases;

drop database <name>;
for each database except information_schema and mysql

use mysql;
INSERT INTO user (Host,User,Password) VALUES (‘host’,‘user’,PASSWORD(‘password’));

To define the new user’s privileges:
GRANT <privilege list> ON database.* TO ‘User’@‘Host’ IDENTIFIED BY ‘password’ [WITH <limit list>];

Remove /var/lib/mysql and /etc/my.cnf.

Reinstall mysql package. You may have to force it. You get a fresh data directory.

I did it and it worked (or at least it looks it works)
It looks though for asks for password when I try to login to mysql

Hm it does not seem to work

sudo /etc/init.d/mysql start
redirecting to systemctl
Job failed. See system logs and 'systemctl status' for details.

What have you got installed – mariadb, mysql-cluster, mysql-community, and from where?

I have installed the best mysql packages :smiley:

I have the three repositories enabled

Index of /distribution/12.1/repo/non-oss
Index of /distribution/12.1/repo/oss
Index of /update/12.1
Index of /suse/12.1

and I went to mysql-community-server and forced to update.

Perplexing. As you probably discovered it is messy to uninstall mysql with KDE installed. I took a more aggressive version of Ken’s suggestion.

 #  rpm -qa *mysql*
 #  rcmysql stop
 #  rm -r /var/lib/mysql  /usr/share/mysql  /usr/lib64/mysql  /usr/bin/mysql*  /etc/my*   /etc/init.d/mysql 

 #  zypper install --force  mysql-community-server  mysql-community-server-client
 #  rcmysql start
 #  mysql

I was then able to import a database, and everything seemed normal. But I did not start with your error messages.

This is what I have installed

rpm -qa *mysql*

and then I did

zypper install --force  mysql-community-server  mysql-community-server-client
Daten des Repositories laden ...
Installierte Pakete lesen ...
Installation von 'mysql-community-server-5.5.16-3.3.1.x86_64' aus Repository 'openSUSE-12.1 OSS' wird erzwungen.
Installation von 'mysql-community-server-client-5.5.16-3.3.1.x86_64' aus Repository 'openSUSE-12.1 OSS' wird erzwungen.
Paketabhängigkeiten auflösen ...

Die folgenden Pakete werden erneut installiert:
  mysql-community-server mysql-community-server-client 

2 zu installierende Pakete.
Gesamtgröße des Downloads: 7,2 MiB. Kein zusätzlicher Speicherplatz wird nach dieser Operation belegt oder freigegeben.
Fortfahren? [j/n/?] (j): j
Paket mysql-community-server-client-5.5.16-3.3.1.x86_64 wird abgerufen (1/2), 736,0 KiB (17,0 MiB entpackt)
Abruf: mysql-community-server-client-5.5.16-3.3.1.x86_64.rpm [fertig]
Paket mysql-community-server-5.5.16-3.3.1.x86_64 wird abgerufen (2/2), 6,5 MiB (41,6 MiB entpackt)
Abruf: mysql-community-server-5.5.16-3.3.1.x86_64.rpm [fertig (5,1 MiB/s)]
Installation von: mysql-community-server-client-5.5.16-3.3.1 [fertig]
Installation von: mysql-community-server-5.5.16-3.3.1 [fertig]
Zusätzliche rpm-Ausgabe:
redirecting to systemctl
redirecting to systemctl

(which means that the installation was correct)

but then

sudo /etc/init.d/mysql start
redirecting to systemctl
Job failed. See system logs and 'systemctl status' for details.

which I do not know how to deal with it.


But did you

#  rm -r /var/lib/mysql  /usr/share/mysql  /usr/lib64/mysql  /usr/bin/mysql*  /etc/my*   /etc/init.d/mysql 

which removes all of the mysql related scripts before the forced re-installation?

If so then the next step might be to remove, then re-install systemd.

What is next to check that the installation work? How I can install a user account inside mysql and then login to mysql?


MySQL root user is separate to the system root user.
MySQL root user has a default blank password, until you set one.
This is how you log in, get hellp, connect to a database, and quit.

user@host:~> mysql -h localhost -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 5.5.16-log Source distribution

Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> help

For information about MySQL products and services, visit:
For developer information, including the MySQL Reference Manual, visit:
To buy MySQL Enterprise support, training, or other products, visit:

List of all MySQL commands:
Note that all text commands must be first on line and end with ';'
?         (\?) Synonym for `help'.
clear     (\c) Clear the current input statement.
connect   (\r) Reconnect to the server. Optional arguments are db and host.
delimiter (\d) Set statement delimiter.
edit      (\e) Edit command with $EDITOR.
ego       (\G) Send command to mysql server, display result vertically.
exit      (\q) Exit mysql. Same as quit.
go        (\g) Send command to mysql server.
help      (\h) Display this help.
nopager   (
) Disable pager, print to stdout.
notee     (	) Don't write into outfile.
pager     (\P) Set PAGER [to_pager]. Print the query results via PAGER.
print     (\p) Print current command.
prompt    (\R) Change your mysql prompt.
quit      (\q) Quit mysql.
rehash    (\#) Rebuild completion hash.
source    (\.) Execute an SQL script file. Takes a file name as an argument.
status    (\s) Get status information from the server.
system    (\!) Execute a system shell command.
tee       (\T) Set outfile [to_outfile]. Append everything into given outfile.
use       (\u) Use another database. Takes database name as argument.
charset   (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
warnings  (\W) Show warnings after every statement.
nowarning (\w) Don't show warnings after every statement.

For server side help, type 'help contents'

mysql&gt; use test;
Database changed
mysql&gt; show tables;
Empty set (0.00 sec)

mysql&gt; use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql&gt; show tables;
| Tables_in_mysql           |
| columns_priv              |
| db                        |
| event                     |
| func                      |
| general_log               |
| help_category             |
| help_keyword              |
| help_relation             |
| help_topic                |
| host                      |
| ndb_binlog_index          |
| plugin                    |
| proc                      |
| procs_priv                |
| proxies_priv              |
| servers                   |
| slow_log                  |
| tables_priv               |
| time_zone                 |
| time_zone_leap_second     |
| time_zone_name            |
| time_zone_transition      |
| time_zone_transition_type |
| user                      |
24 rows in set (0.00 sec)

mysql&gt; \q

The manual is available on-line; this is the tutorial chapter:

Thanks for the reply and time spent.
After the installation is finished
this fails

sudo /etc/init.d/mysql start
redirecting to systemctl
Job failed. See system logs and ‘systemctl status’ for details.

If you will not follow my diagnostic suggestions in the order provided, and report back at each stage before asking the next question, I cannot help you.

Actually you are behaving as a troll to deliberately waste my time.

I am following exactly what you say. In the previous post you were suggesting me to connect to mysql
by doing

mysql -h localhost -u root -p .

Before that I ahve to start mysql server which I tried doing with /etc/init.d/mysql start. So before trying what you are suggesting I am stuck at a previous point.

Thank you very much for your answer. I have moved all your posts again and now everything works.!

I would like now to drop all the databases installed in it

show databases;
| Database |
| information_schema |
| mysql |
| performance_schema |
| test |

so to start from scratch. Are the 4 depicted above the default ones ?


This is wheris thread started. You have been given the list of files and directories to remove, and the packages to re-install via YaST.

Yes they are standard databases, but will not be “as new” if you have been experimenting. You can use
*YaST >> System >> System Services (Runlevel) *
to enable/disable mysql running at boot etc. I usually use rcmysql to stop and start the daemon on the fly.