Ubuntu MySQL database operations

Source: Internet
Author: User

1. delete mysql

Sudo apt-get autoremove mysql-server
Sudo apt-get remove mysql-common

2. install

Sudo apt-get install mysql-server
Sudo apt-get install php5-mysql

Configuration:

The MYSQL we just installed has only one default root user, and there is no password. At this time, we must set a password root for MYSQL.

Terminal input:
Mysql-u root-p
Mysql> enter password: root

Mysql> \ q exit mysql

3. Add a user, set the password, and have all permissions for the redmine_default database.

Mysql> grant all privileges on redmine_default. * to 'redmine '@ 'localhost' identified by 'redmine ';

4. How to save the mysql root Password

Run as root


-1. End the currently running mysql process.
#/Etc/init. d/mysql stop

-2. Run in mysql security mode and skip permission verification.
#/Usr/bin/mysqld_safe -- skip-grant-tables

-3. log on to mysql as the root user.
# Mysql-u root

-4. Modify the root user password.
Mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with-

Database changed
Mysql> update user set Password = PASSWORD ('root') where User = 'root ';
Query OK, 3 rows affected (0.00 sec)
Rows matched: 3 Changed: 3 Warnings: 0

Mysql> exit

-5. End mysql security mode and run mysql in normal mode.
#/Etc/init. d/mysql restart

Note:

Mysql server creates a default mysql database, where a data item manages the account and password information of each user. All database data managed by the server is stored under/var/lib/mysql/. As long as the data below is not deleted, even if mysql is re-installed, the mysql database can still be accessed after being reinstalled.

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.