Server build 1 Install MySQL database

Source: Internet
Author: User
Tags administrator password

One, install Mysql-service

(1) Check if MySQL is installed in the system

Enter sudo netstat-tap inside the terminal | grep MySQL

If not reflected, the installed results are not displayed and are not installed. If you can enumerate the MySQL information, it means that you have installed

(2) Installing MySQL

In terminal input sudo apt-get install mysql-server mysql-client

During this installation, you will be asked to enter the password for the root user (managing MySQL database user, non-linux system user), as required.

(3) Log in to MySQL and test if the installation is successful

sudo netstat-an | grep MySQL//After checking through the above command, if you see that the socket with MySQL is in the Listen state, the installation is successful

In the terminal input Mysql-u root-p next will prompt you to enter the password, enter the correct password, you can enter (the installation is successful)

(4) MySQL configuration

Set up remote access (normally, the 3306 port that MySQL occupies is only listening on IP 127.0.0.1, denying access to other IPs (Netstat can see it). Cancel local listener needs to modify MY.CNF file)

//After installation, the SQLyog tool cannot be connected without the following configuration

sudo vi/etc/mysql/My.cnfbind-address =127.0.0.1    //find this content and comment, no comment indicates only local connectionsudo service mysql restart//Restart service is also available after modifying the my.cnf file/etc/init.d/mysql [Start|stop|restart]//allow users to log on remotelyGrant all privileges on*. * to Root@"%"Identified by"Password"With grant Option;flush privileges;

Basic knowledge:

Start MySQL service: sudo service MySQL start

Stop MySQL service: sudo service MySQL stop

Restart MySQL service: sudo service mysql restart

Modify the administrator password for MySQL: sudo mysqladmin-u root password newpassword

MySQL post-installation directory structure (this agency is only for installation with Apt-get install)

Database storage directory:/var/lib/mysql/

Related configuration file directory:/usr/share/mysql

Related Command Storage directory:/usr/bin (mysqladmin mysqldump, etc.)

Startup footstep Storage directory:/etc/rc.d/init.d/

Second, after installing MySQL also need to install MySQL driver mysql-connector-c-6.1.6-src

Unzip mysql-connector-c-6.1. 6-src.zipcd mysql-connector-c-6.1. 6-srcmkdir BUILDCD build CMake. Make   // Compile source // install

Third, install MySQL C + + connection Library

TAR-XF mysql++-3.2. 2 . tar.gz
. /Configuremakesudo make install

Source compiled after the installation of So, in the execution of the program may be reported so can not be found to start, the following error occurred:
Error while loading shared Libraries:libiconv.so.2:cannot open Shared object file:no such file or directory

Add the so directory to/etc/ld.so.conf and run Ldconfig. Run the program again, OK.

" /usr/local/lib " >>/etc/ld.so.confldconfig

Ld.so.conf and Ldconfig are maintenance of the system dynamic link library

Server build 1 Install MySQL database

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.