MySQL Learning notes

Source: Internet
Author: User
Tags mysql client

Background: Unfamiliar with Ubuntu is not familiar with MySQL, only using Rhel and Oracle experience. Try to start learning to use MySQL on Ubuntu.

For a comparison of the differences between Ubuntu and Redhat package management, see the article

First verify that you have MySQL installed, using the dpkg command:

$ dpkg-l|grep-i mysqlii libdbd-mysql-perl 4.025-1 amd64 Perl5 dat        Abase interface to the MySQL databaseii libmysqlclient18:amd64 5.5.49-0ubuntu0.14.04.1 AMD64        MySQL Database client Libraryii mysql-client-5.5 5.5.49-0ubuntu0.14.04.1 AMD64        MySQL Database client binariesii mysql-client-core-5.5 5.5.49-0ubuntu0.14.04.1 AMD64          MySQL Database Core Client binariesii Mysql-common 5.5.49-0ubuntu0.14.04.1 all              MySQL database Common files, e.g./ETC/MYSQL/MY.CNFII mysql-server 5.5.49-0ubuntu0.14.04.1                    All MySQL database Server (Metapackage depending on the latest version) II mysql-server-5.5 5.5.49-0ubuntu0.14.04.1 AMD64 MySQL database server binaries and system database Setupii MySQL        -server-core-5.5       5.5.49-0ubuntu0.14.04.1 AMD64 MySQL database server binariesii php5-mysql 5.5.9+dfsg-1ubuntu4.16 AMD64 MySQL module for php5ii python-mysqldb 1.2.3- 2UBUNTU1 AMD64 Python interface to MySQL

Then verify that MySQL is already running:

$ pgrep mysqld8573

Then glance at the configuration file, MySQL configuration file:/etc/mysql/my.cnf, where the data file storage path is specified.

Wow, the amount of information is still very large, as an Oracle DBA, take a look at this discovery there are a lot of places to pay attention to, do not worry.

$ cat/etc/mysql/my.cnf## The MySQL database server configuration file.## You can copy this to one of:#-"/etc/mysql/my.c NF "To set global options,# –" ~/.my.cnf "to set user-specific options.# # One can use all long options and the program s upports.# Run program with--help to get a list of the available options and with#--print-defaults to see which it would actu Ally understand and use.## for explanations see# http://dev.mysql.com/doc/mysql/en/server-system-variables.html# this  Would be passed to all MySQL clients# It had been reported that passwords should is enclosed with ticks/quotes# escpecially If they contain "#" chars ... # Remember to edit/etc/mysql/debian.cnf when changing the socket location. [Client]port= 3306socket=/var/run/mysqld/mysqld.sock# Here's entries for some specific programs# the following values as Sume least 32M ram# This is formally known as [Safe_mysqld]. Both versions is currently parsed. [Mysqld_safe]socket=/var/run/mysqld/mysqld.socknice= 0[mysqld]## * Basic settings#user= mysqlpid-file=/var/run/mysqld/mysqld.pidsocket=/var/run/mysqld/mysqld.sockport= 3306basedir=/usrdatadir=/var/lib/mysqltmpdir=/tmplc-messages-dir=/usr/share/mysqlskip-external-locking## Instead of skip-networking The default is now-listen only on# localhost which are more compatible and are not less secure . bind-address= 0.0.0.0## * Fine tuning#key_buffer= 16mmax_allowed_packet= 16mthread_stack= 192Kthread_cache_size = 8         # This replaces the startup script and checks MyISAM tables if needed# the first time they is touchedmyisam-recover = Backup#max_connections = 100#table_cache = 64#thread_concurrency = 10## * Query Cache Configura tion#query_cache_limit= 1mquery_cache_size = 16m## * Logging and replication## Both location gets rotated by the CR onjob.# be aware, this, log type is a performance killer.# as of 5.1 you can enable the log at runtime! #general_log_fil E =/var/log/mysql/mysql.log#general_log             = 1## Error Log-should is very few entries. #log_error =/var/log/mysql/error.log## Here's can see queries With especially long duration#log_slow_queries=/var/log/mysql/mysql-slow.log#long_query_time = * log-queries-not-using-indexes## The following can be used as easy-replay backup logs or for replication.# note:if is setting up a replication slave, see README. Debian about# Other settings-need to change. #server-id= 1#log_bin=/var/log/mysql/mysql-bin.logexpire_logs_d ays= 10max_binlog_size = 100m#binlog_do_db= include_database_name#binlog_ignore_db= include_database_name## * Inno db## InnoDB is enabled by default with a 10MB datafile in/var/lib/mysql/.# Read the manual for more InnoDB related option S. there is many!## * Security features## Read The manual, too, if you want chroot!# chroot =/var/lib/mysql/## for Gener ating SSL Certificates I recommend the OpenSSL GUI "Tinyca". # # ssl-ca=/etc/mysql/cacert.pem# ssl-cert=/etc/mysql/ Server-cert.pem# ssl-key=/etc/mysql/server-key.pem[mysqldump]quickquote-namesmax_allowed_packet= 16M[mysql]# no-auto-rehash# faster start of MySQL but no tab completition[isamchk]key_buffer= 16m## * important:additional settings T Hat can override those from this file!# the files must end with "CNF", otherwise they ' ll be ignored.#!includedir/etc/m ysql/conf.d/

Find a way to log in to the database with the MySQL client

MySQL Learning notes

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.