How to install mysql on linux using the tar package?



  • Note: Adjust equivalent command for other linux types. This article uses redhat/centos linux.

    There is a dependancy to have libaio installed. Check to see if these exist or install.

    $ yum search libaio  
    $ sudo yum install libaio 
    

    Create a group.

    $ sudo groupadd mysql
    

    Create a user.

    $ sudo useradd -r -g mysql -s /bin/false mysql
    

    Get version you require from https://dev.mysql.com/downloads/
    **Extract into /usr/local, use one of the package installer repositories, or obtain individual packages and install using your native OS package installer.

    $ /usr/local
    $ sudo tar zxvf ~/mysql-8.0.16-el7-x86_64.tar.gz
    ...
    ...
    ...
    

    Rename the directory to mysql

    $ sudo mv mysql-8.0.16-el7-x86_64/ mysql
    

    Change owner and group for files.

    $ sudo chown -R mysql:mysql mysql
    

    Add PATH if you need to.

    $ PATH=/usr/local/mysql/bin:$PATH;export PATH
    

    Initialize the data directory.

    $ sudo mkdir mysql-files
    $ sudo chown mysql:mysql mysql-files
    $ sudo chmod 750 mysql-files
    
    $ sudo bin/mysqld --initialize --user=mysql
    2019-05-25T10:31:05.595529Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.16) initializing of server in progress as process 4692
    2019-05-25T10:31:08.872313Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 
    2019-05-25T10:31:10.076728Z 0 [System] [MY-013170] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.16) initializing of server has completed
    

    Start the server.

    $ sudo bin/mysqld_safe --user=mysql &
    

Log in to reply
 

© Lightnetics 2024