MySQL installation and remote connection configuration in Ubuntu _ MySQL

Source: Internet
Author: User
Install MySQL and configure remote connection in Ubuntu

BitsCN.com
Configuration of MySQL installation and remote connection configuration in Ubuntu 1. install MySQL in ubuntu and enter sudo apt-get install mysql-server in the ubuntu command line to install the mysql service, by default, mysql-client is automatically installed when mysql-server is installed. The installed mysql configuration file is located at/etc/mysql/my. the shortcut icon for cnf to start mysql is/etc/init. d/mysql 2. Encoding Solution view the current MYSQL character set [run in mysql command line mode]: show variables like 'character % '; change the encoding: sudo vim/etc/mysql/my. cnf find [client] and add the following two sentences: // the default character set is utf8 default-character-set = utf8 find [mysqld] and add the following four sentences: (Note that each row cannot contain spaces) // the default character set is utf8 default-character-set = utf8 // set utf8 encoding when connecting to the mysql database, run init_connect = 'set NAMES utf8' for the mysql database for utf8 and then switch to the final line mode of vim to run wq Generate the vim editor. stop Database Service: sudo/etc/init. d/mysql stop restart: s udo/etc/init. d/mysql start enter the database: mysql-uroot-p (your password) view the encoding: show variables like '% character %'; at this time, it should be all UTF-8 encoded. III. MySQL service to add boot Auto Start to boot Auto Start: sudo update-rc.d mysql defaults removed from boot auto start: sudo update-rc.d-f mysql remove IV. remote connection to MySQL vim/etc/mysql/my under ubuntu. cnf finds the bind-address = 127.0.0.1 line, comment out (below) # bind-address = 127.0.0.1 or change to bind-address = 0.0.0.0 to allow access by any IP address, or specify an IP address by yourself. Restart MySQL sudo/etc/init. d/mysql restart authorize the user to remotely connect to grant all privileges on *. * to root @ "%" identified by "password" with grant option; flush privileges; the first line of the command is explained as follows ,*. *: the first * indicates the database name, and the second * indicates the table name. This means that all tables in all databases are authorized to users. Root: Grant the root account. "%": Indicates that the authorized user's IP address can be specified. This indicates that any IP address can access the MySQL database. "Password": password corresponding to the allocated account. replace the password with your mysql root account password. The second command is to refresh the permission information, that is, to make the settings take effect immediately. In this case, remote connection to MySQL under ubuntu should be able to connect to bitsCN.com

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.