The path of mysqld started after mysql binary is not installed by the root user is incorrect.

Source: Internet
Author: User


Mysql binary non-root users start mysqld after Installation Problems 1. Non-root users install binary mysql distribution edition create users> useradd fc www.2cto.com> passwd fc enter password :... log On with fc and upload the binary mysql version. My mysql 32-bit mysql-5.1.57-linux-i686-glibc23.tar.gz is decompressed, create a permission table] $ scripts/mysql_install_db -- basedir =/home/fc/app/mysql -- datadir =/home/fc/app/mysql/data/3307 -- user = fc (note: the following parameters must be specified. In addition, it is best to run together with scripts/mysql_install_db. This is also the case in the official documents, so as to avoid errors and cause startup errors later.) The permission table is also initialized, then, specify the configuration file my. put cnf in the $ HOME directory:
[Python] # Example MySQL config file for medium systems. # www.2cto.com # This is for a system with little memory (32 M-64 M) where MySQL plays # an important part, or systems up to 128 M where MySQL is used together with # other programs (such as a web server) # MySQL programs look for option files in a set of # locations which depend on the deployment platform. # You can copy this option file to one of those # locations. for information about these locations, see :# http://dev.mysql.com/doc/mysql/en/option-files.html # In this file, you can use all long options that a program supports. # If you want to know which options a program supports, run the program # with the "-- help" option. # The following options will be passed to all MySQL clients [client] # password = your_password port = 3307 socket =/home/fc/app/mysql/tmp/3307/mysql. sock # Here follows entries for some specific programs www.2cto.com # The MySQL Server [mysqld] character-set-server = utf8 port = 3307 socket =/home/fc/app/mysql/tmp/3307/mysql. sock skip-external-locking basedir =/home/fc/app/mysql datadir =/home/fc/app/mysql/data/3307/log-error =/home/fc/ log/3307/mysqld. err pid-file =/home/fc/app/mysql/tmp/3307/mysql. pid key_buffer_size = 16 M max_allowed_packet = 1 M table_open_cache = 64 sort_buffer_size = 512 K net_buffer_length = 8 K Read_buffer_size = 256 K Bytes = 512 K Bytes = 8 M max_connections = 200 slow_query_log = 1 #{0 | 1 off | on} slow_query_log_file =/home/fc/log/3307/mysql-slow.log long_query_time = 1 # query of tables that are not updated frequently, cache query query_cache_type = 1 query_cache_size = 10 M general_log = 0 general_log_file =/home/fc/log/3307/mysql. log www.2cto.com query_cache_size = 8 M # skip-networking skip-name-resolve Skip-innodb-checksums # Replication Master Server (default) # binary logging is required for replication log-bin =/home/fc/log/3307/mysql-bin # binary logging format-mixed recommended binlog_format = mixed binlog_cache_size = 1 M max_binlog_cache_size = 4096 M expire-logs-days = 8 sync_binlog = 20 # Uncomment the following if you are using InnoDB tables innodb_data_home_dir =/home/fc/data/3307/innod B _data_file_path = ibdata1: 10 M: autoextend memory =/home/fc/data/3307/memory = 800 M sort_buffer_size = 5 M tmp_table_size = 64 M memory = 32 M memory = 64 # default unit: MB www.2cto.com innodb_thread_concurrency = 8 innodb_log_file_size = 200 M innodb_log_buffer_size = 8 M default-storage-engine = innodb innodb_flush_log_at_trx_c Ommit = 1 # Set .. _ log_file_size to 25% of buffer pool size # innodb_log_file_size = 5 M # bytes = 8 M # bytes = 1 # bytes = 50 bytes = 2 [mysqldump] quick max_allowed_packet = 16 M [mysqld_safe] log-error =/home/fc/app/mysql/log/3307/mysqld. log pid-file =/home/fc/app/mysql/tmp/3307/mysql. pid [mysql] no-auto-rehash port = 3307 socket =/home/fc/app/mysql/tmp/3307/mysql. sock # Remove the next comment character if you are not familiar with SQL # safe-updates [myisamchk] key_buffer_size = 20 M sort_buffer_size = 20 M read_buffer = 2 M writable [mysqlhotcopy] interactive-timeout is good, everything is ready. You can start mysqld process to enter the basedir directory fc/app/mysqlmysql] $ cd binbin] $ mysqld_safe -- defaults-file = ~ /My. cnf & started successfully, view process ps-ef | grep mysqld found the problem [plain] fc 7780 7582 24 00:00:00 pts/10/usr/local/mysql/bin/mysqld -- defaults-file = ~ /My. cnf -- basedir =/home/fc/app/mysql -- datadir =/home/fc/app/mysql/data/3307/-- log-error =/home/fc/app/ mysql/log/3307/mysqld. log -- pid-file =/home/fc/app/mysql/tmp/3307/mysql. pid -- socket =/home/fc/app/mysql/tmp/3307/mysql. sock -- port = 3307 was not found, although the mysqld program started in the fc/app/mysql/bin directory, however, it is mysqld running in/usr/lcoal/mysql. Why? After searching for parameters for a long time, we found that there was no configuration error and we could not solve it all the time. If we changed the startup method: go to the base Directory fc/app/mysql] $ bin/msyqld_safe -- defaults-file = ~ /My. cnf & after the startup, find the mysqld process. Everything is normal. Why? The possible reason is that mysqld_safe itself is the daemon of mysqld, which is also a shell script. In the script, the default basedir is: usr/local/mysql, if we enter the bin directory when starting mysqld, this directory cannot be found in this daemon. If so, the directory/usr/local/mysql/will be automatically matched, I installed mysql in this directory, so the system automatically matches this mysqld program and runs it. Let's take a look at the shell code of mysqld_safe: [python] MY_PWD = 'pwd' # Check for the directories we wowould perform CT from a binary release install if test-n "$ MY_BASEDIR_VERSION"-a-d "$ MY_BASEDIR_VERSION" then # BASEDIR is already overridden on command line. do not re-set. # Use BASEDIR to discover le. if test-x "$ MY_BASEDIR_VERSION/libexec/mysqld" then ledir = "$ MY_BASEDIR_VERSION/libexec" elif test-x "$ MY_BASEDIR_VE RSION/sbin/mysqld "then ledir =" $ MY_BASEDIR_VERSION/sbin "else ledir =" $ MY_BASEDIR_VERSION/bin "fi www.2cto.com elif test-f" $ relpkgdata "/english/errmsg. sys-a-x "$ MY_PWD/bin/mysqld" then MY_BASEDIR_VERSION = "$ MY_PWD" # Where bin, share and data are ledir = "$ MY_PWD/bin" # Where mysqld is # Check for the directories we wowould perform CT from a source install elif test-f "$ relpkgdata"/english/errmsg. sys- A-x "$ MY_PWD/libexec/mysqld" then MY_BASEDIR_VERSION = "$ MY_PWD" # Where libexec, share and var are ledir = "$ MY_PWD/libexec" # Where mysqld is elif test-f "$ relpkgdata"/english/errmsg. sys-a-x "$ MY_PWD/sbin/mysqld" then MY_BASEDIR_VERSION = "$ MY_PWD" # Where sbin, share and var are ledir = "$ MY_PWD/sbin" # Where mysqld is # Since we didn't find anything, used the compiled-in defaults else MY_BASEDIR_V ERSION = '/usr/local/mysql 'ledir ='/usr/local/mysql/bin' fi if we enter the bin directory: when ledir runs to elseMY_BASEDIR_VERSION = '/usr/local/mysql 'ledir ='/usr/local/mysql/bin', it should be: "$ MY_PWD/bin/mysqld" the problem is that, without cd to mysql basedir, mysql will start www.2cto.com PS from/usr/loca/mysql/bin/mysqld: the connection problem is that we started according to the socket, so when we connect, if we use localhost or the default status to connect to mysql, then, we must use the specified socket full path to connect. Otherwise, the system will search for/tmp/mysql by default. if you cannot find the socket, an error is returned. Of course, you can use the-h 127.0.0.1 method to connect to the mysql database, so you do not need to specify the-S socket path. There are two mysql Connection Methods, one is through socket, one is to use TCP/IP to connect to [plain] <pre name = "code" class = "python"> </pre> </ pre> </pre> by Lin Zhi

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.