MySQL installation and basic commands

Source: Internet
Author: User

Developed and used TOMCAT version 5.0.28
MYSQL database mysql-5.0.22 for Development and Use
MYSQL database development tool Navicat_MySQL
JDK1.4

Basic work:

1. Configure the environment variable JDK environment variable: JAVA_HOME
TOMCAT environment variable: CATALINA_HOME
MYSQL environment variable: MYSQL_HOME

Problems:

MYSQL installation takes a long time

MYSQL basic commands:

Installation Process

1. Decompress mysql-noinstall-5.0.37-win32.zip to a directory and add it to the E: \ myserver directory.

2. Compile the mysql running configuration file my. ini.
My. ini
-----------------------------
[WinMySQLAdmin]
# Specify the mysql Service Startup File
Server = E: \ myserver \ mysql-5.0.37-win32 \ bin \ mysqld-nt.exe

[Mysqld]
# Set the installation directory of mysql
Basedir = E: \ myserver \ mysql-5.0.37-win32
# Set the data storage directory of the mysql database, which must be data or \ xxx \ data
Datadir = E: \ myserver \ mysql-5.0.37-win32 \ data
# Set the character set of the mysql server
Default-character-set = gbk

[Client]
# Set the character set of the mysql client
Default-character-set = gbk
-----------------------------

3. Install the mysql Service
Enter the directory E: \ myserver \ MS-DOS \ bin from the mysql-5.0.37-win32 window and run the following command:
Mysqld -- install mysql5 -- defaults-file = E: \ myserver \ mysql-5.0.37-win32 \ my. ini

4. Start the mysql database
In the above command window, enter the command: net start mysql5
In this way, the mysql service is started.

5. (local) log on to the mysql database
In the preceding command window, run mysql-u root-p.
Enter the password.
The password for the first installation of the mysql decompress version administrator root is blank, so you can directly press enter to log on to the mysql database.

If you are not logging on to mysql for the first time and you still have a network address, you can use the following command to log on to the mysql server, which may be far away or local. This logon method is called "remote Logon". The command is as follows:
Mysql-h 192.168.3.143-u root-p
Mysql-h 192.168.3.143-u root-pleizhimin

-H indicates the logon ip address,-u indicates the user, and-p specifies the password. If no password is written after-p, the system will prompt you to enter the password, -p can also be used to directly write the password, so that you no longer need to enter the password.

6. operate databases and tables
After logging on to the mysql database, you can run the command: use Database Name
After specifying the database object for operation, you can operate the tables in the database. The operation method is of course an SQL command.

7. change the password of the mysql database administrator root.
Mysql database has a mysql database by default, which is a mysql System database used to save a lot of information such as database users and permissions. To change the password, you must operate the mysql database user table.

The password of the root user in mysql is still empty, which is very insecure. Assume that you want to change the password to "leizhimin ".

In the preceding command window, run the following command:
Use mysql;
Grant all on *. * to root @ '%' identified by 'leizhimin' with grant option;
Commit;

This command adds a root user with all permissions. The password is "leizhimin", which can be accessed locally or through the network. It is emphasized that the root user of the mysql system can only access the database locally. Its @ character is followed by localhost. For details, you can view the uer table of mysql Data. In this way, there are two root users, one is the original system, and the other is newly created, for the convenience of management, delete the mysql root User and keep the created root user because the user can access mysql through the network.

  • 1
  • 2
  • Next Page

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.