Install mysql under Linux

xiaoxiao2021-03-06  54

Install MySQL Suppose you put all the necessary source or packages under / TMP. If you download the RPM package, it is relatively simple; if you download the binary package (you don't have a RPM program or if you want to be customized), then it will be a little bit a little. RPM package installation You must be a root user to use RPM installer, the following is the installation process: $ CD / TMP $ su # rpm -uvh mysql * (All packages related to mysql) This will install all 3 MySQL you download package. If your system is redhat Linux, it is recommended to use the RPM installation method because all work is made by the RPM program. Source installation is slightly troublesome with binary source code relative to the RPM installation. However, we can customize the relevant parameters of the installation in the installation script without using the RPM mode to install only the default to install. Installation binary source code If you download the binary source code, its name is similar to: mysql-3.22.21-pc-linux-gnu-i686.tar.gz. You must be a root user, then extract to the / usr / local directory, steps below: $ CD / USR / LOCAL $ su # tar -zxvf /tmp/mysql-3.22.21-pc-linux-gnu-i686.tar. After all the files are decompressed, a directory named mysql-3.22.21-PC-Linux-GNU-I686 will be created. We make a symbolic link for this directory, and give it a more friendly name mysql (excluded mysql-3.22.21-pc-linux-gnu-i686): # ln -s mysql-3.22.21-pc- Linux-gnu-i686 mysql If you have a new version of MySQL, you can only extract the source code to the new path, and then you only need a symbolic link. This is very convenient, and the data is more secure. Create a MySQL user, now we will build a user account that runs the MySQL daemon, and all MySQL files are owned by this account. Use LinuxConf or Useradd command to add a account called MySQL, before adding, make sure no one has registered this account, and temporarily disable the login function (but generally the debug machine without others login, so this step Exemption) For mysql, you will first let us change the mysql directory and file ownership to mysql users and root group: # cd / usr / local # chown -r mysql: root mysql-3.22.21-pc-linux-gnu -i686 MySQL then runs a small scripter to establish an initialized mysql database. Please complete this task with a MySQL user, which is the only chance we can directly use this account. # SU mysql $ cd mysql $ scripts / mysql_install_db $ exit If there is no error message display, it can be. Automatically run mysql inside the MySQL binary package, there is a startup scriptor called MySLQ.Server. Copy it to the /etc/rc.d/init.d directory: # cd /etc/rc.d/init.d# cp /usr/local/mysql/support-files/mysql.server MySQL then put its properties Change to "X" (executable, executable) # chmod x mysql Finally, running chkconfig to add MySQL to your system's launch service group.

转载请注明原文地址:https://www.9cbs.com/read-116235.html

New Post(0)