Pretty simple question here. I just want a SQL database on my version of Kali linux so I can practice SQL.
I opened the command line and entered tried to start mysql and get an error.
> mysql -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'
I don't know about Kali, but on Ubuntu it would be
$ sudo service mysql start
Once that command returns, the
mysqld service has started, so you can use the
mysql client to connect to it.
Of course, you also have to make sure you have the
mysql-server package installed, not just
mysql-common, and that you've initialized the database instance. Complete post-installation instructions can be found in the official documentation, but the short version is
mysqluser account. This is the account that will "own" the server process once it starts.
/var/lib/mysql; you can change this by editing
As root, execute the server daemon with the
--initialize switch. Check
whereis to determine the correct path, then
$ sudo /path/to/mysqld --initialize --user=mysql
This command will twiddle itself for a while, then display an automatically-generated password and exit. Once the command returns, the database instance has been initialized and the system tables created. You can now start the database instance normally (using
service start), then log in as the database user
root (which is not the same as the system user
root) using the password from above, then change your password, create a new database user, log in as that user, create a user database, and start creating tables.
Again, the official documentation is the place to look for this; if any of the instructions in the official documentation differ from my instructions, you should ignore me and follow the official documentation's instructions.