MySQL installation and operation under Linux

Source: Internet
Author: User

sudo apt-get// for update source, get package list sudo apt-get// for upgrading specified packages  Install//installation Remove//Remove package Autoremove//automatic removal of all non-functional packages purge   //package with configuration file Remove source  //To download the specified package of source check   // Used to verify that a dependency is damaged

Linux Install MySQL:

1. sudo apt-get install Mysql-server
Then the prompt interface appears:
A. Set the MySQL user password
B. Confirm Password

2. Verify that the MySQL database is started
Ps-ef|grep mysqld

3. Accessing the MySQL Database
Mysql-u root-p
Enter the password after entering the database;
Show all databases under current MySQL: show databases;
Enter a database: use XXX;
Displays all tables under the current database: show tables;
Exit Current database: Quit

4. Uninstall MySQL
sudo apt-get autoremove--purge mysql-server

5. Recommended software: XAMPP, including Apache, MySQL, PHP
Add Execute permission: sudo chmod 777 Xampp-lnux-x64-5.5-installer.run
Install Xampp:sudo./xampp-lnux-x64-5.5-installer.run
Click Next to install
After installing, click Manage Servers, click Start, open MySQL with Apache
Open the browser, enter localhost, then click Chinese, click on the left phpMyAdmin to see the control Panel

=====================================================
Working with MySQL databases and tables

1. Create a MySQL database using and deleting
XAMPP-bin, you can use the MySQL terminal tool to start the terminal from here:
-Enter MySQL:./mysql-u root-p
-Create databases Abel:create database Abel;
(Note: Database names can not be the same name, not too long, can not be a pure number, can not use keywords such as SELECT, etc., the database name should be cautious, do not arbitrarily modify)
-Switch/Enter Abel database: Use Abel;
-delete Abel databases: drop database Abel;

Table Operations for 2.MySQL databases
-Create data table: Creation table Tbl_user (ID int (3), name varchar (8), password varchar (20));

-Modify the data table name:
ALTER TABLE Tbl_user Rename to Tbl_member;
Or
Rename table Tbl_user to Tbl_member;

-Add a field to the Data Table Email:alter table Tbl_user add eamil varchar (255) not NULL;

-Modified data table already has Field ID newid:alter table tbl_user change ID newid int (3);

-Delete data table already has field eamil:alter table tbl_user drop email;

-Delete Data sheet: drop table tbl_user;

3. Access to database and table information and introduction to database physical files
-Access MySQL database: Mysql-u root-p
-Show all databases under current MySQL: show databases;
-Enter a database: use XXX;
-Displays all data tables under the current database: show tables;

-Show all data tables under the XXX database: show tables from XXX;
-View the structure of the data sheet tbl_user: describe Tbl_user;

MySQL installation and operation under Linux

Related Article

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.