Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
MariaDb Essentials

You're reading from   MariaDb Essentials Quickly get up to speed with MariaDB—the leading, drop-in replacement for MySQL, through this practical tutorial

Arrow left icon
Product type Paperback
Published in Oct 2015
Publisher
ISBN-13 9781783982868
Length 206 pages
Edition 1st Edition
Tools
Arrow right icon
Toc

Table of Contents (10) Chapters Close

Preface 1. Installing MariaDB 2. Databases and Tables FREE CHAPTER 3. Getting Started with SQL 4. Importing and Exporting Data 5. Views and Virtual Columns 6. Dynamic Columns 7. Full-Text Searches 8. Using the CONNECT Storage Engine Index

Upgrading MariaDB

If a package manager has been used to install MariaDB, the patch upgrades, like 10.0.12 to 10.0.13, are automatic. Each package manager supports a command to upgrade the packages, and will also take care to upgrade the dependencies if needed. If no package manager is used (for example, when we are working on Windows or if we have installed the generic Linux/UNIX binaries), we will need to manually uninstall and re-install MariaDB. This is also true for minor or major version upgrades such as 10.0 to 10.1. The following commands can be used with the package managers that have been used in this chapter:

  • With apt-get (Debian):
    sudo apt-get update
    sudo apt-get upgrade
    
  • With Yum (Red Hat):
    sudo yum update MariaDB-server MariaDB-client
    
  • With emerge (Gentoo):
    emerge -avDuN mariadb
    
  • With Homebrew (MacOS X):
    brew upgrade mariadb
    

Usually, we want the new version to read our old database. So, first we need to set up the data directory, which is the directory in which the databases are written by default. A common path is /var/mysql. To use this path, we will add the following line in the configuration file:

datadir=/var/mysql

This setting will not take effect until MariaDB is restarted.

At this point, we need to upgrade the format of our databases. Since the data has been written with an older release, some modifications to the files could be necessary before the new version of MariaDB can read it. For this purpose, MariaDB distributions include a tool called mysql_upgrade. This must be done even if a package manager has been used for upgrading MariaDB.

The mysql_upgrade tool must be run when the server is running. It reads the options from the configuration files. However, if the login credentials are not written in the configuration files, the typical invocation for mysql_upgrade is the following:

mysql_upgrade -u<user_name> -p<password>

Replace <user_name> with a valid username and <password> with the corresponding password.

After running mysql_upgrade, we will be able to work again without databases!

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image