Install MySQL diagram under Ubuntu 12.04

Source: Internet
Author: User

First download the MySQL Linux installation package, from the official website, I downloaded the 5.6 Community version, downloaded and uploaded to Ubuntu.

The package is placed in the ~/download directory, and the full installation command is as follows:

1, decompression tar.gz

Tar–xzf mysql-5.6.26-linux-glibc2.5-x86_64.tar.gz

2. Rename the extracted folder

MV Mysql-5.6.26-linux-glibc2.5-x86_64 MySQL

3. Move the MySQL folder to the/usr/local directory

sudo mv ~/download/mysql/usr/local

4. Go to MySQL Directory

Cd/usr/local/mysql

5. Add MySQL Users and groups

sudo useradd-r MySQL

6. Change MySQL folder own and GRP to MySQL

sudo chown-r mysql:mysql mysql/

7. Execute MySQL Installation script

sudo scripts/mysql_install_db--user=mysql

(If the Libaio package is not installed, there will be an error message, after installing Libaio-dev, then run the script.) Delete Rm-rf/etc/my.cnf If you still have an error)

sudo apt-get install Libaio-dev

8, change the directory permissions back, only keep the data directory for the MySQL user

sudo chown-r root:root MySQL.

sudo chown-r mysql:mysql data

9. Copy the MySQL configuration file to the ETC directory (global configuration)

Note: The default profile name for version 5.6 is changed by the original My-medium in order to My-default.

sudo cp support-files/my-default.cnf/etc/my.cnf

10. Start MySQL

sudo bin/mysqld_safe--user=mysql &

11. Initialize the MySQL root user password

sudo bin/mysqladmin-u root-p ' user-defined password ';

#ps-a|grep MySQL
Show similar:
1829? 00:00:00 Mysqld_safe
1876? 00:00:31 mysqld
2. #kill-9 1829
3. #kill-9 1876

12, copy Mysql.server script to/ETC/INIT.D (initialization service, some people like to change to MySQL, change here can)

sudo cp support-files/mysql.server/etc/init.d/mysql.server

14. View MySQL Running status

sudo service mysql.server status
If it works, MySQL running will be displayed.

If not running is displayed, the service should not be started earlier, and can be started directly with service Mysql.server start

sudo service mysql.server [status|start|stop]

15. Let MySQL boot [defaults], cancel boot [remove]

sudo update-rc.d-f mysql.server defaults [remove]

16. Add the Mysql/bin/mysql command to the user command, or add the Mysql/bin directory to the path

To join the user command:

sudo ln-s/usr/local/mysql/bin/mysql/usr/local/bin/mysql

Add Environment variables:

Export path= $PATH:/usr/local/mysql/bin

17. Allow root users to log in remotely

1> into Mysql:mysql–u root–p

2> Change database: use MySQL;

3> login from any host: Grant all privileges on * * to [email protected] '% ' identified by ' cipher text ' with GRANT option;

4> login from specified host: Grant all privileges on * * to [email protected] ' 192.168.1.101 ' identified by ' passw0rd ' with GRANT option;

5> authorization entry into force: flush privileges;

6> See if the host is added for% authorization: SELECT * from user;

7> View Database Character set: Show variables like ' character% ';

After we start MySQL, we can then test it and use the "MySQL" command to access the MySQL database console.
$mysql-U Root

Here the reason for using-u root is because I am now a general user (Firehare), if you do not add-u root, MySQL will assume that it is firehare log in. Note that I do not have access to root user mode here because it is not necessary. In general, the database in MySQL operation, there is no need to enter the root user mode, only in the setting of this possibility.

After entering MySQL, the most important thing is to set up the root user password in MySQL, otherwise, the MySQL service is not safe to say.
Mysql> GRANT All privileges on * * to [e-mail protected] identified by "123456";
If you need to use root for remote access from other machines, you can use
Mysql> GRANT All privileges on * * to [e-mail protected] "%" identified by "123456";
Note that I use 123456 as the root user's password, but the password is not secure, please use a combination of uppercase and lowercase letters and numbers, and not less than 8 bits.

Configuration file Reference:

[HTML]View PlainCopy  
  1. # for advice The change settings
  2. # http://dev.mysql.com/doc/refman/5.6/en/server-configuration-defaults.html
  3. # * * * Don't EDIT this FILE. It ' s a template which'll be copied to the
  4. # * * * default location during install, and would be replaced if you
  5. # * * * * Upgrade to a newer version of MySQL.
  6. [Client]
  7. Port = 3306
  8. default-character-set=UTF8
  9. # Here's entries for some specific programs
  10. # The following values assume you has at least 32M RAM
  11. [Mysqld]
  12. character_set_server=UTF8
  13. lower_case_table_names=1
  14. init_connect=' SET NAMES UTF8 '
  15. lower_case_table_names=1
  16. max_connections=
  17. Max_allowed_packet = 32M
  18. Thread_cache_size =
  19. Thread_concurrency = 8
  20. Query_cache_size = 128M
  21. # Remove Leading # and set to the amount of RAM for the most important data
  22. # Cache in MySQL. Start at 70% of all RAM for dedicated server, else 10%.
  23. # innodb_buffer_pool_size = 128M
  24. # Remove Leading # to turn on a very important data integrity option:logging
  25. # Changes to the binary log between backups.
  26. # Log_bin
  27. # These is commonly set, remove the # and set as required.
  28. # Basedir = ...
  29. # DataDir = ...
  30. # port = ... ..
  31. # server_id = ...
  32. # socket = ... ..
  33. # Remove Leading # To set options mainly useful for reporting servers.
  34. # The server defaults is faster for transactions and fast selects.
  35. # Adjust sizes as needed, experiment to find the optimal values.
  36. join_buffer_size = 16M
  37. sort_buffer_size = 16M
  38. # read_rnd_buffer_size = 2M
  39. Sql_mode=no_engine_substitution,strict_trans_tables
  40. [Mysqldump]
  41. Quick
  42. Quote-names
  43. Max_allowed_packet = 32M
  44. [MySQL]
  45. No-auto-rehash

Reference article: http://blog.csdn.net/njchenyi/article/details/17615391

Install MySQL diagram under Ubuntu 12.04

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.