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

  1. make sure installer has created mysql user account. account "own" server process once starts.
  2. change data directory. (i used installer's default of /var/lib/mysql; can change editing my.cnf.)
  3. as root, execute server daemon --initialize switch. check whereis determine correct path, then

    $ sudo /path/to/mysqld --initialize --user=mysql 
  4. 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 user root (which not same system user root) 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

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -