How do you start a MySQL server on linux? -
pretty simple question here. want sql database on version of kali linux can practice sql.
i opened command line , entered tried start mysql , error.
> mysql -u root error 2002 (hy000): can't connect local mysql server through socket '/var/run/mysqld/mysqld.sock'
i made sure installed using apt-get.
what steps need take able make database tables , data can query?
i don't know kali, on ubuntu be
$ sudo service mysql start
once command returns, mysqld
service has started, can use mysql
client connect it.
of course, have make sure have mysql-server
package installed, not mysql-client
, mysql-common
, , you've initialized database instance. complete post-installation instructions can found in the official documentation, short version is
- make sure installer has created
mysql
user account. account "own" server process once starts. - change data directory. (i used installer's default of
/var/lib/mysql
; can change editingmy.cnf
.) as root, execute server daemon
--initialize
switch. checkwhereis
determine correct path, then$ sudo /path/to/mysqld --initialize --user=mysql
this command twiddle while, display automatically-generated password , exit. once command returns, database instance has been initialized , system tables created. can start database instance (using
service start
), log in database userroot
(which not same system userroot
) using password above, change password, create new database user, log in that user, create user database, , start creating tables.
again, the official documentation place this; if of instructions in the official documentation differ instructions, should ignore me , follow the official documentation's instructions.
Comments
Post a Comment