Install MARIADB based on binary program

Source: Internet
Author: User
Tags file permissions

  1. Environment: Classroom, default lftp IP address: 172.16.0.1
  2. Binary based programs must be installed in the/usr/local directory, and the extracted directory must be called MySQL
  3. Lftp 172.16.0.1 get to Mariadb-5.5.36 installation package
      1. Get to local Directory
  4. To expand a program:
  5. [Email protected] yum.repos.d]# tar XF mariadb-5.5.36-linux-x86_64.tar.gz-c/usr/local
  6. CD to this directory
  7. [email protected] mariadb-5.5.36-linux-x86_64]# LL
    Total 212
    Drwxr-xr-x 2 root root 4096 20:46 bin
    -rw-r--r--1 17987 07:50 COPYING
    -rw-r--r--1 26545 07:50 COPYING. LESSER
    Drwxr-xr-x 3 root root 4096 20:46 data
    Drwxr-xr-x 2 root root 4096 20:46 docs
    Drwxr-xr-x 3 root root 4096 20:46 include
    -rw-r--r--1 8694 07:50 install-binary installation program method
    Drwxr-xr-x 3 root root 4096 20:46 Lib
    Drwxr-xr-x 4 root root 4096 20:46 man
    Drwxr-xr-x root root 4096 20:47 mysql-test
    -rw-r--r--1 108813 07:50 README installation program method
    Drwxr-xr-x 2 root root 4096 20:46 scripts
    Drwxr-xr-x root root 4096 20:46 share
    Drwxr-xr-x 4 root root 4096 20:46 Sql-bench
    Drwxr-xr-x 4 root root 4096 20:46 Support-files
    [email protected] mariadb-5.5.36-linux-x86_64]# less install-binary
  8. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898107q2eg.png "width=" 495 "height=" 193 "/>
  9. The above is explicitly written on how to install the method.
  10. Since post-installation data is usually very important in the/usr/local/mariadb-5.5-36..../data directory, it is recommended to be placed in a logical volume, which can be easily extended after the data volume is large and can be recovered by a snapshot. So divide the area:
  11. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898109cb0x.png "width=" 496 "height="/>
  12. You can then create a directory under the root directory, called MyData, that specifically puts the database data.
  13. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898111mhvt.png "width=" 498 "height=" "/>"
  14. Then create the system user MySQL and create the system group MySQL
  15. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898113zwoi.png "width=" 498 "height="/>
  16. It is inconvenient to mount it directly under the root system, so creating a directory in the directory you just built is called/data, such as Mkdir/mydata/data
  17. Because the MySQL service should be logged in with a normal user, change the directory of the database and the main genus of the files under the directory, such as:
  18. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898114merx.png "width=" 498 "height=" 126 "/>
  19. Re-CD back to the/usr/local directory, to the downloaded mariadb ... the name of the package is renamed, because it requires MySQL.
  20. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_14078981175gwt.png "width=" 503 "height=" 195 "/>
  21. Then we CD into the/usr/local directory, first let us see what files are generated and modify the following directory and file permissions:
  22. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898120vg4a.png "width=" height= "163"/>
  23. where s in the bin/directory is the server side and C represents the client.
  24. Below we want to change the/usr/local/mysql/data directory and file permissions, because they are related to the database data, need to open the process of ordinary users.
  25. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898126axll.png "width=" 507 "height=" 262 "/>
  26. MySQL initializes the first time before booting, but CDs to Support_files
  27. View the following 5 files:
  28. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898127xztb.png "width=" 511 "height=" "/>"
  29. They are applied to different memory platforms, so we have to look at our own memory in order to use: the free command
  30. Locate the profile that belongs to your own memory size, copy it to the new/etc/mysql directory, and rename it to MY.CNF
  31. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898129aqol.png "width=" 519 "height=" 137 "/>
  32. Edit the My.cnf, and then fill in the blanks with the mydata of the saved data you just created, and be sure to [mysqld]
  33. Datadir=/mydata/data
  34. Viewing the installation script
  35. [email protected] scripts]# LL
    Total 16
    -rwxr-xr-x 1 root mysql 16168 Feb 11:08 mysql_install_db
  36. [Email protected] scripts]# scripts/mysql_install_db--help
    Usage:./mysql_install_db [OPTIONS]
    --basedir=path the path to the MariaDB installation directory.
    --builddir=path If using--srcdir with out-of-directory builds, you
    Would need to set the the location of the build
    directory where built files reside.
    --cross-bootstrap for internal use. Used when building the MariaDB system
    Tables on a different host than the target.
    --datadir=pathThe path to the MariaDB data directory.
    --defaults-extra-file=name
    Read this file after the global files is read.
    --defaults-file=name only read default options from the given file name.
    --force causes mysql_install_db to run even if DNS does not
    Work. In this case, the grant table entries that normally
    Use hostnames would use IP addresses.
    --help Display this Help and exit.
    --ldata=path the path to the MariaDB data directory. Same as
    --datadir.
    --no-defaults Don ' t read the default options from the any option file.
    --defaults-file=path Read only this configuration file.
    --RPM for internal use. This option was used by RPM files
    During the MariaDB installation process.
    --skip-name-resolve use IP addresses rather than hostnames when creating
    Grant table entries. This option can be useful if
    Your DNS does not work.
    --srcdir=path the path to the MariaDB source directory. This option
    Uses the compiled binaries and support files within the
    Source tree, useful for if you don ' t want to install
    MariaDB yet and just want to create the system tables.
    --user=user_nameThe login username to use for running mysqld. Files
    and directories created by Mysqld'll be owned by this
    User.
  37. The above two options are important to define which user is logged on when the installation starts and where the directory where the database data resides
  38. and must go back to the MySQL directory for the installation operation! Because it relies on files in the bin/directory. EXECUTE as follows:
  39. [Email protected] mysql]# scripts/mysql_install_db--user=mysql--datadir=/mydata/data
    Installing Mariadb/mysql system tables in '/mydata/data ' ...
    Ok
  40. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898133wmu9.png "width=" 525 "height=" 231 "/>
  41. But there is still work to be done, and the service script needs to be added under/ETC/RC.D/INIT.D so that the services mysqld Start/stop/status/restart ..., so
  42. Copy the Mysql.server service script in the directory under Support-files, paste it into/etc/rc.d/init.d/and name it mysqld, and finally use LL to see if other has Execute permissions:
  43. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898135kilj.png "width=" 531 "height=" "/>
  44. And you can load it into boot, use the Chkconfig–add service script name
  45. Chkconfig–list View 0-6 of those in the open:
  46. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898137fxiy.png "width=" 536 "height=" "/>"
  47. Finally, we use service mysqld start to open the services
  48. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898140m3ks.png "width=" 534 "height=" 205 "/>
  49. But execution can be problematic, showing
  50. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898142uw4i.png "width=" 539 "height=" "/>
  51. Tip We also have to go to/etc/profile.d/to edit a mysql.sh, which exports environment variables.
  52. Add Export path=/usr/local/mysql/bin: $PATH
  53. Finally source a bit, then you can start normally!
  54. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898146wvfz.png "width=" 541 "height=" 179 "/>
  55. --------------------------------------------------------------------------------------------------------------- ------------------------------------------------
  56. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898148wrsl.png "width=" 540 "height=" 214 "/> Select version (); Select the release and return the status of the function
  57. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_14078981499bqx.png "width=" 545 "height=" 277 "/> Select User (); View Users && select Current_User (); View Current user
  58. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898151rwbf.png "width=" 545 "height=" 268 "/> can also be calculated with MySQL!
  59. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_14078981533tot.png "width=" 548 "height=" 124 "/> The header file to make a soft connection, when developing other program headers,
  60. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898157b9a1.png "width=" 553 "height=" 157 "/>
  61. Finally about the export library file, because mariadb are 18, 19 header file library, so edit/etc/ld.so.conf.d/mysql.conf
  62. Write/usr/local/mysql/lib
  63. Ldconfig–v again | grep MySQL
  64. 650) this.width=650; "Style=" border-right-0px; border-top-width:0px; border-bottom-width:0px; border-left-width:0px "title=" image "border=" 0 "alt=" image "src=" http://img1.51cto.com/attachment/201408/13/ 6249823_1407898159zife.png "width=" 555 "height=" 197 "/>
  65. Jobs done;

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.