Fedora 16 yum how to start mysql after installation and add it as a system service

Source: Internet
Author: User
Tags comparison table mysql command line

How to start fedora 16 yum after mysql is installed, and add to System Service 1 yum install mysql # yum install mysql-server mysql-devel if ERROR 2002 (HY000) is encountered ): can't connect to local MySQL server through socket '/var you Can use the following command: start mysql service # systemctl start mysqld. service sets mysqld to start automatically # systemctl enable mysqld. service 2. Usage of systemctl this command is a system process management command; comparison table, take apache/httpd as an example. Run the old command to enable a service to automatically start chkconfig -- level 3 httpd on systemctl enable httpd. ser Vice prevents a service from automatically starting chkconfig -- level 3 httpd off systemctl disable httpd. service check service status service httpd status systemctl status httpd. service (service details) systemctl is-active httpd. service (only show whether it is Active) display all started services chkconfig -- list systemctl list-units -- type = service to start a service httpd start systemctl start httpd. service to stop a service httpd stop systemctl stop httpd. service restart a service httpd restart systemctl r Estart httpd. service 3. After installation, you can check the installation location of the mysql command to find the installation location of the mysql server File # rpm-ql mysql-server to find the installation location of the mysql client file # rpm-ql mysql 4. The mysql management database is not installed by default, run the installation command # mysql_install_db or add the parameter # mysql_install_db -- user = root -- basedir =/usr -- datadir =/var/lib/mysql after installing the mysql database, you can start mysql, you can view the values of basedir and datadir. Start mysql # mysqld_safe -- user = root & find the mysqld process number # ps aux | grep mysqld to end mysqld. The process number is obtained by the preceding command, note that the process Number of/usr/bin/mysqld is not the process Number of/bin/sh/usr/bin/mysqld_safe. # Kill 35431 5. Download the support-files/mysql. server File in a mysql Linux binary compression installation package (the version is almost the same, for example, 5.5.xx) and modify the two lines. Basedir =/usrdatadir =/var/lib/mysql search 'start, change $ bindir/mysqld_safe -- datadir = "$ datadir" to $ bindir/mysqld_safe -- user = root -- datadir = "$ datadir ". Then # cp mysql. server/etc/rc. d/init. d/mysqld # chmod + x/etc/rc. d/init. d/mysqld now, mysql is successfully registered as a service. You can run mysql using the # service mysqld start | stop | restrat command. Start mysql # service mysqld start to add password 123 to the mysql root User # mysqladmin-u root password 123 use mysql command line Client # mysql-u root-p 123 6. start mysqld. when service mysqld start is used to start the service, the following error occurs: Redirecting to/bin/systemctl start mysqld. service Failed to issue method call: Access denied start mysql with systemctl. the following error occurs: Failed to issue method call: Unit mysql. service failed to load: No such file or directory. see system logs and 'systemctl status mysql. service 'for details. enter mysql directly and the following ERROR occurs: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql. sock '(2) solution: the owner of mysql is root, while mysql is executed as a mysql user. Of course, it cannot be written, which is a problem of system permissions. chown-R mysql: mysql/var/lib/mysql /.
 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.