i.am.developer

[번역]mysql, mysqld, mysqladmin의 차이점? 본문

프로그래밍/Mysql

[번역]mysql, mysqld, mysqladmin의 차이점?

jongwow 2019. 5. 1. 12:47
출처: https://stackoverflow.com/questions/6115612/how-to-convert-an-entire-mysql-database-characterset-and-collation-to-utf-8

linux에서 mysql를 구동하는데 명령어가 mysqld가 있고 mysql이 있길래 궁금해서 찾아봤더니 이미 스택오버플로우에 있는 질문이네요.


mysql과 mysqld, mysqladmin의 차이점을 찾는 쉬운 방법은 man pages를 읽어보면 됩니다.

  • mysqld는 server executable, 서버에서 실행가능한 것들 중 하나입니다.
  • mysql은 command line client, 커맨드 라인 클라이언트입니다.
  • mysqladmin은 maintainance or administarative utility, 유지 및 관리 유틸리티입니다.

각각 다른 목적을 수행합니다. 단순히 차이점이라고 할 만한 것이 없습니다. 못 박을 때 망치쓰고 나사 조일 때 드라이버 쓰는 것처럼 다른 목적에 다른 도구를 써야합니다.

 

만약 당신이 데이터베이스 서버에 쿼리를 갱신하고 싶다면, 클라이언트(client)를 사용해서 연결해야합니다. 클라이언트는 mysql를 실행하는 서버와 연결합니다. 만약 당신이 서버에 관리적인 조정(administrative ajdustment)을 해야한다면 administration utility를 사용해야 합니다.

 

일반적으로 서버는 구동되고 있는 OS에 의해 시작되고 멈춥니다. 클라이언트들(다른 종류의 클라이언트)은 서버 안에서 데이터를 갖고 있는 사람들에 의해 시작되고 사용됩니다. 그리고 관리자는 관리 툴을 이용해 시스템상의 서버를 관리합니다.

 


간단하게 생각하면 Mysqld = Mysql + D, (D는 Daemon의 약자)

mysqld는 백그라운드에서 돌아가고 있는 프로세스, MYSQL 서버이고

mysql은 우분투의 터미널처럼 sql문을 실행시켜주는 command-line client입니다.

 

이하는 man 페이지에 있는 mysql의 정의입니다.

...더보기

        mysql is a simple SQL shell with input line editing capabilities. It supports interactive and

       noninteractive use. When used interactively, query results are presented in an ASCII-table format. When
       used noninteractively (for example, as a filter), the result is presented in tab-separated format. The
       output format can be changed using command options.

       If you have problems due to insufficient memory for large result sets, use the --quick option. This forces
       mysql to retrieve results from the server a row at a time rather than retrieving the entire result set and
       buffering it in memory before displaying it. This is done by returning the result set using the
       mysql_use_result() C API function in the client/server library rather than mysql_store_result().

           Note
           Alternatively, MySQL Shell offers access to the X DevAPI. For details, see MySQL Shell 8.0 (part of
           MySQL 8.0)[1].

       Using mysql is very easy. Invoke it from the prompt of your command interpreter as follows:

           shell> mysql db_name

       Or:

           shell> mysql --user=user_name --password db_name
           Enter password: your_password

       Then type an SQL statement, end it with ;, \g, or \G and press Enter.

       Typing Control+C interrupts the current statement if there is one, or cancels any partial input line
       otherwise.

       You can execute SQL statements in a script file (batch file) like this:

           shell> mysql db_name < script.sql > output.tab

       On Unix, the mysql client logs statements executed interactively to a history file. See the section called
       “MYSQL CLIENT LOGGING”.

아래는 mysqld의 man 페이지입니다.

...더보기

       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.

           Note
           Some installation packages contain a debugging version of the server named mysqld-debug. Invoke this
           version instead of mysqld for debugging support, memory allocation checking, and trace file support
           (see Section 28.5.1.2, “Creating Trace 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

       MySQL Server also has a set of system variables that affect its operation as it runs. System variables can
       be set at server startup, and many of them can be changed at runtime to effect dynamic server
       reconfiguration. MySQL Server also has a set of status variables that provide information about its
       operation. You can monitor these status variables to access runtime performance characteristics.

       For a full description of MySQL Server command options, system variables, and status variables, see
       Section 5.1, “The MySQL Server”. For information about installing MySQL and setting up the initial
       configuration, see Chapter 2, Installing and Upgrading MySQL.