Skip to content
logo
Percona Server for MySQL
Post-installation
Initializing search
    percona/psmysql-docs
    percona/psmysql-docs
    • Home
      • The Percona XtraDB storage engine
      • List of features available in Percona Server for MySQL releases
      • Percona Server for MySQL feature comparison
      • Changed in Percona Server 8.0
      • Understand version numbers
      • Install Percona Server for MySQL
        • Install using APT repository
        • Files in DEB package
        • Build APT packages
        • Install from downloaded DEB packages
        • Apt pinning
        • Run Percona Server for MySQL
        • Uninstall
        • Install using a RPM repository
        • Files in RPM package
        • Install from downloaded RPM packages
        • Run Percona Server for MySQL
        • Uninstall
        • Install with binary tarballs
        • Binary tarballs available
        • Install Percona Server for MySQL from a source tarball
        • Compile Percona Server for MySQL 8.0 from source
      • Post-installation
        • Installed using binary files or compiling from source
          • Initialize the data directory
          • Test the server
          • Set service to run at boot time
        • All installations
          • Update the root password
          • Secure the server
        • Populate the time zone tables
      • Percona Server for MySQL in-place upgrading guide: from 5.7 to 8.0
      • Upgrade using the Percona repositories
      • Upgrade from systems that use the MyRocks or TokuDB storage engine and partitioned tables
      • Upgrade using Standalone Packages
      • Downgrade Percona Server for MySQL
      • Running Percona Server for MySQL in a Docker Container
      • Docker environment variables
      • Improved InnoDB I/O scalability
      • Adaptive network buffers
      • Multiple page asynchronous I/O requests
      • Thread pool
      • XtraDB performance improvements for I/O-bound highly-concurrent workloads
      • Prefix index queries optimization
      • Limit the estimation of records in a Query
      • Jemalloc memory allocation profiling
      • The ProcFS plugin
      • Binary logs and replication improvements
      • Compressed columns with dictionaries
      • Extended SELECT INTO OUTFILE/DUMPFILE
      • Extended SET VAR optimizer hint
      • Improved MEMORY storage engine
      • Suppress warning messages
      • Limiting the disk space used by binary log files
      • Support for PROXY protocol
      • SEQUENCE_TABLE(n) function
      • Slow query log rotation and expiration
      • Trigger updates
      • Extended mysqlbinlog
      • Extended mysqldump
      • InnoDB full-text search improvements
      • Too many connections warning
      • Handle corrupted tables
      • Percona Toolkit UDFs
      • Kill idle transactions
      • XtraDB changed page tracking
      • Enforcing storage engine
      • Expanded fast index creation
      • Backup locks
      • Audit log plugin
      • Start transaction with consistent snapshot
      • Extended SHOW GRANTS
      • Utility user
      • Working with SELinux
      • Working with AppArmor
      • PAM authentication plugin
      • Server variables
      • SSL improvements
      • Data masking
        • Using LDAP authentication plugins
        • LDAP authentication plugin system variables
        • Data at Rest Encryption
        • Use the keyring component or keyring plugin
          • Using the Key Management Interoperability Protocol (KMIP)
          • Use the Amazon Key Management Service (AWS KMS)
          • FIDO authentication plugin
        • Encryption functions
        • Encrypt File-Per-Table Tablespace
        • Encrypt schema or general tablespace
        • Encrypt system tablespace
        • Encrypt temporary files
        • Encrypt Binary Log Files and Relay Log Files
        • Encrypting the Redo Log data
        • Encrypt the undo tablespace
        • Rotate the master key
        • Advanced encryption key rotation
        • Encrypt doublewrite buffers
        • Verify the encryption for tables, tablespaces, and schemas
      • User statistics
      • Slow query log
      • Extended show engine InnoDB status
      • Show storage engines
      • Process list
      • Misc. INFORMATION_SCHEMA tables
      • Thread based profiling
      • InnoDB page fragmentation counters
      • Stacktrace
      • Libcoredumper
      • Manage group replication flow control
      • Group replication system variables
      • Percona MyRocks introduction
      • Percona MyRocks installation guide
      • Updated supported features
      • MyRocks limitations
      • Differences between Percona MyRocks and Facebook MyRocks
      • MyRocks Information Schema tables
      • MyRocks server variables
      • MyRocks status variables
      • Gap locks detection
      • Data loading
      • Installing and configuring Percona Server for MySQL with ZenFS support
      • TokuDB introduction
      • TokuDB installation
      • Use TokuDB
      • Fast updates with TokuDB
      • TokuDB files and file types
      • TokuDB file management
      • TokuDB background ANALYZE TABLE
      • TokuDB variables
      • TokuDB status variables
      • TokuDB fractal tree indexing
      • TokuDB troubleshooting
      • TokuDB Performance Schema integration
      • Frequently asked questions
      • Migrate and removing the TokuDB storage engine
      • Percona TokuBackup
      • Release notes index
      • Percona Server for MySQL 8.0.32-24 (2023-03-20)
      • Percona Server for MySQL 8.0.31-23 (2023-02-09)
      • Percona Server for MySQL 8.0.30-22 Update (2022-11-21)
      • Percona Server for MySQL 8.0.30-22 (2022-11-21)
      • Percona Server for MySQL 8.0.29-21 (2022-08-08)
      • Percona Server for MySQL 8.0.28-20 (2022-06-20)
      • Percona Server for MySQL 8.0.28-19 (2022-05-12)
      • Percona Server for MySQL 8.0.27-18 (2022-03-02)
      • Percona Server for MySQL 8.0.26-17 (2022-01-26)
      • Percona Server for MySQL 8.0.26-16 (2021-10-20)
      • Percona Server for MySQL 8.0.25-15 (2021-07-13)
      • Percona Server for MySQL 8.0.23-14 (2021-05-12)
      • Percona Server for MySQL 8.0.22-13 (2020-12-14)
      • Percona Server for MySQL 8.0.21-12 (2020-10-13)
      • Percona Server for MySQL 8.0.20-11 (2020-07-21)
      • Percona Server for MySQL 8.0.19-10 (2020-03-23)
      • Percona Server for MySQL 8.0.18-9
      • Percona Server for MySQL 8.0.17-8
      • Percona Server for MySQL 8.0.16-7
      • Percona Server for MySQL 8.0.15-6
      • Percona Server for MySQL 8.0.15-5
      • Percona Server for MySQL 8.0.14
      • Percona Server for MySQL 8.0.13-4
      • Percona Server for MySQL 8.0.13-3
      • Percona Server for MySQL 8.0.12-2rc1
      • List of variables introduced in Percona Server for MySQL 8.0
      • Development of Percona Server for MySQL
      • Trademark policy
      • Index of INFORMATION_SCHEMA tables
      • Frequently asked questions
      • Copyright and licensing information
      • Glossary

    • Installed using binary files or compiling from source
      • Initialize the data directory
      • Test the server
      • Set service to run at boot time
    • All installations
      • Update the root password
      • Secure the server
    • Populate the time zone tables

    Post-installation¶

    Depending on the type of installation, you may need to do the following tasks:

    Installed using binary files or compiling from source¶

    Task
    Initialize the data dictionary
    Test the server
    Set service to start at boot time

    Initialize the data directory¶

    If you install the server using either the source distribution or generic binary distribution files, the data directory is not initialized, and you must run the initialization process after installation.

    Run mysqld with the –initialize option or the initialize-insecure option.

    Executing mysqld with either option does the following:

    • Verifies the existence of the data directory

    • Initializes the system tablespace and related structures

    • Creates system tables including grant tables, time zone tables, and server-side help tables

    • Creates root@localhost

    You should run the following steps with the mysql login.

    1. Navigate to the MySQL directory. The example uses the default location.

      $ cd /usr/local/mysql
      
    2. Create a directory for the MySQL files. The secure_file_priv uses the directory path as a value.

      $ mkdir mydata
      

      The mysql user account should have the drwxr-x--- permissions. Four sections define the permissions; file or directory, User, Group, and Others.

      The first character designates if the permissions are for a file or directory. The first character is d for a directory.

      The rest of the sections are specified in three-character sets.

      Permission User Group Other
      Read Yes Yes No
      Write Yes No No
      Execute Yes Yes No
    3. Run the command to initialize the data directory.

      $ bin/mysqld --initialize
      

    Test the server¶

    After you have initialized the data directory, and the server is started, you can run tests on the server.

    This section assumes you have used the default installation settings. If you have modified the installation, navigate to the installation location. You can also add the location by Setting the Environment Variables.

    You can use the mysqladmin client to access the server.

    If you have issues connecting to the server, use the root user and the root account password.

    $ sudo mysqladmin -u root -p version
    
    Expected output
    Enter password:
    mysql Ver 8.0.19-10 for debian-linux-gnu on x86_64 (Percona Server (GPL), Release '10', Revision 'f446c04')
    ...
    Server version      8.0.19-10
    Protocol version    10
    Connection          Localhost via UNIX socket
    UNIX socket         /var/run/mysqld/mysqld.sock
    Uptime:             4 hours 58 min 10 section
    
    Threads:    2 Questions:    16 Slow queries: 0 Opens: 139 Flush tables: 3
    Open tables: 59  Queries per second avg: 0.0000
    

    Use mysqlshow to display database and table information.

    $ sudo mysqlshow -u root -p
    
    Expected output
    Enter password:
    
    +---------------------+
    |      Databases      |
    +=====================+
    | information_schema  |
    +---------------------+
    | mysql               |
    +---------------------+
    | performance_schema  |
    +---------------------+
    | sys                 |
    +---------------------+
    

    Set service to run at boot time¶

    After a generic binary installation, manually configure systemd support.

    The following commands start, check the status, and stop the server:

    $ sudo systemctl start mysqld
    $ sudo systemctl status mysqld
    $ sudo systemctl stop mysqld
    

    Run the following command to start the service at boot time:

    $ sudo systemctl enable mysqld
    
    Run the following command to prevent a service from starting at boot time:

    $ sudo systemctl disable mysqld
    

    All installations¶

    Task
    Update the root password
    Secure the server
    Populate the time zone tables

    Update the root password¶

    During an installation on Debian/Ubuntu, you are prompted to enter a root password. On Red Hat Enterprise Linux and derivatives, you update the root password after installation.

    Restart the server with the --skip-grant-tables option to allow access without a password. This option is insecure. This option also disables remote connections.

    $ sudo systemctl stop mysqld
    $ sudo systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
    $ sudo systemctl start mysqld 
    $ mysql
    

    Reload the grant tables to be able to run the ALTER USER statement. Enter a password that satisfies the current policy.

    mysql> FLUSH PRIVILEGES;
    mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'rootPassword_12';
    mysql> exit
    
    If, when adding the password, MySQL returns ERROR 1819 (HY000) Your password does not satisfy the current policy, run the following command to see policy requirement.

    mysql> SHOW VARIABLES LIKE 'validate_password%';
    
    Redo your password to satisfy the requirements.

    Stop the server, remove the --skip-grant-tables option, start the server, and log into the server with the updated password.

    $ sudo systemctl stop mysqld 
    $ sudo systemctl unset-environment MYSQLD_OPTS 
    $ sudo start mysqld 
    $ mysql -u root -p
    

    Secure the server¶

    The mysql_secure_installation script improves the security of the instance.

    The script does the following:

    • Changes the root password

    • Disallows remote login for root accounts

    • Removes anonymous users

    • Removes the test database

    • Reloads the privilege tables

    The following statement runs the script:

    $ mysql_secure_installation
    

    Populate the time zone tables¶

    The time zone system tables are the following:

    • time_zone

    • time_zone_leap_second

    • time_zone_name

    • time_zone_transition

    • time_zone_transition_type

    If you install the server using either the source distribution or the generic binary distribution files, the installation creates the time zone tables, but the tables are not populated.

    The mysql_tzinfo_to_sql program populates the tables from the zoneinfo directory data available in Linux.

    A common method to populate the tables is to add the zoneinfo directory path to mysql_tzinfo_to_sql and then send the output into the mysql system schema.

    The example assumes you are running the command with the root account. The account must have the privileges for modifying the mysql system schema.

    $ mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root -p -D mysql
    

    Contact us

    For free technical help, visit the Percona Community Forum.

    To report bugs or submit feature requests, open a JIRA ticket.

    For paid support and managed or consulting services , contact Percona Sales.


    Last update: 2023-02-15
    Percona LLC and/or its affiliates, © 2023
    Made with Material for MkDocs

    Cookie consent

    We use cookies to recognize your repeated visits and preferences, as well as to measure the effectiveness of our documentation and whether users find what they're searching for. With your consent, you're helping us to make our documentation better.