Ubuntu MySQL (mariadb)

Source: Internet
Author: User

In the ubuntu16.04 version, when you install MySQL, the default installation is MARIADB.

installation command:

1. Use administrator privileges (by default, the user under Ubuntu is the user name that is set when the system is installed, but the installation and uninstallation or deletion requires administrator privileges to avoid the user switching with sudo before each confident command, you can switch directly to the root user)

sudo su

The difference between sudo and Su: (Transfer from http://www.cnblogs.com/google4y/archive/2011/08/18/2144864.html)

1. Common denominator: Both have access to the root user;

2. Difference: Su is only rooted, the work environment is not changed, or the user's working environment before switching, sudo is fully rooted and rooted in the working environment.

Update for 2.apt-get Package Manager

Apt-get Updateapt-get Upgrade

 

You should first run update and then upgrade . Neither of them automatically runs the other.

    • apt-get updateUpdates the list of available packages and their versions, but it does not install or upgrade any packages.
    • apt-get upgradeActually installs newer versions of the packages you have.

After updating the lists, the Package Manager knows on available updates for the software you have installed. This is what you first want to update .

(Copy in Http://askubuntu.com/questions/94102/what-is-the-difference-between-apt-get-update-and-upgrade)

Other words:

Apt-get Update updates the version of the package that needs to be installed, but does not install or upgrade a package that is already installed.

Apt-get upgrade is to upgrade the package version that you have installed, after getting the new version of the package.

So it is update to get the new version, then upgrade to upgrade to the new version.

3. Installing MARIADB

Apt-get Install Mariadb-server

After the installation process is complete, you can see if the database process started (note: The process name of the MARIADB database process is still mysql)

Ps-e | grep MySQL

Or see if the MySQL service is started and see the process number of the process

Ps-aux | grep MySQL

4. Restart the MySQL service

Service MySQL Restart

5. Use MySQL to enter MARIADB

By default, the MARIADB database is a password-free login.

Mysql

Or

Mysql-uroot-p

After the password appears, enter login directly

1) Change Password:

UPDATE user SET Password=password ("My_password") WHERE user= "root";

2) Refresh the database for the changes to take effect.

Flush Privileges

3) exit the database (three methods)

The first type: mariadb> \q the second type: mariadb> exit Third: Mariadb> quit

4) Restart the database service

Service MySQL Restart

Problems you may encounter:

(1) Unable to access database

ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:yes)

Or

ERROR 1045 (28000): Access denied for user ' root ' @ ' localhost ' (using Password:no)

The first error is because the installation is under the root authority of Sudo su, because after exiting the root administrator privileges for the normal user rights, so access is restricted, you need to log in to MySQL command before adding sudo or switch to Su

The second error is because after modifying the password after sudo su to get root permissions without password login errors, the use of the password after the normal login.

The value of field plugin after entering MySQL database is unix_socket

Ubuntu MySQL (mariadb)

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.