mysql:mysqld、mysqld_safe、mysql、

MYSQL 启动:

mysqld — The MySQL Server

mysqld, also known as MySQL Server, is the main program that does most of the work in a MySQL installation. MySQL Server manages access to the MySQL data directory that contains databases and tables. The data directory is also the default location for other information such as log files and status files.

When MySQL server starts, it listens for network connections from client programs and manages access to databases on behalf of those clients.

The mysqld program has many options that can be specified at startup. For a complete list of options, run this command:

shell> mysqld --verbose --help

mysqld_safe — MySQL Server Startup Script

mysqld_safe  is the recommended way to start a  mysqld  server on Unix.  mysqld_safe  adds some safety features such as restarting the server when an error occurs and logging runtime information to an error log file. A description of error logging is given later in this section.

mysqld_safe Options


Format Description Introduced
--basedir Path to MySQL installation directory  
--core-file-size Size of core file that mysqld should be able to create  
--datadir Path to data directory  
--defaults-extra-file Read named option file in addition to usual option files  
--defaults-file Read only named option file  
--help Display help message and exit  
--ledir Path to directory where server is located  
--log-error Write error log to named file  
--malloc-lib Alternative malloc library to use for mysqld  
--mysqld Name of server program to start (in ledir directory)  
--mysqld-safe-log-timestamps Timestamp format for logging 5.7.11
--mysqld-version Suffix for server program name  
--nice Use nice program to set server scheduling priority  
--no-defaults Read no option files  
--open-files-limit Number of files that mysqld should be able to open  
--pid-file Path name of process ID file  
--plugin-dir Directory where plugins are installed  
--port Port number on which to listen for TCP/IP connections  
--skip-kill-mysqld Do not try to kill stray mysqld processes  
--skip-syslog Do not write error messages to syslog; use error log file  
--socket Socket file on which to listen for Unix socket connections  
--syslog Write error messages to syslog  
--syslog-tag Tag suffix for messages written to syslog  
--timezone Set TZ time zone environment variable to named value  
--user Run mysqld as user having name user_name or numeric user ID user_id  


/home/mypath/mysql/bin/mysqld_safe --defaults-file=/home/mypath/mysql/etc/my.cnf

 /home/mypath/mysql/bin/mysqld --defaults-file=/home/mypath/mysql/etc/my.cnf --basedir=/home/my/mysql --datadir=/home/mypath/mysql/data --plugin-dir=/home/mypath /mysql/lib/plugin --log-error=/home/mypath/mysql/log/mysql.err --pid-file=/home/mypath/mysql/tmp/mysql.pid --socket=/home/mypath/mysql/tmp/mysql.sock --port=3377

Unix系统下本地连接MySQL可以采用Unix域套接字方式,mysql.sock文件服务器与本地客户端进行通信的Unix套接字文件,程序与mysqlserver处于同一台机器,发起本地连接时可用。该文件由参数socket指定

mysql>show variables like 'socket'\G;

当MySQL实例启动时,会将自己的进程ID写入一个文件中—该文件即为pid文件。该文件可由参数pid_file控制

mysql — The MySQL Command-Line Tool

mysqladmin — Client for Administering a MySQL Server


ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'db'

You may need to set up a root account for your MySQL database:

In the terminal type:

mysqladmin -u root password 'root'

And then to invoke the MySQL client:

mysql -h localhost -u root -p

mysqldump — A Database Backup Program

你可能感兴趣的:(mysql:mysqld、mysqld_safe、mysql、)