"Environment and file version"
Red hat linux v6.2
MySQL linux version x86-x64 v5.6
"Prepare the required documents"
first go to the official website to download MySQL of the Linux version, you can select the appropriate version for the installed operating system.
then extract the files to a directory, such as /usr/local/ and rename it to MySQL . Make sure that eventually all the files are /usr/local/mysql/ This directory, you also need to navigate to this directory when using command lines, and subsequent operations are done in this directory. .
"Initialize database File"
then copy support-files/my-default.cnf to the current directory, and name it my.cnf, and modify the contents as follows:
[Mysqld]
Skip-name-resolve # Skip table Scan, you can speed up the execution tree of MySQL
Lower_case_table_names=1 # table names all use lowercase
datadir=/usr/local/mysql/data/ # Setting data file storage location
Socket=/usr/local/mysql/mysql.sock
User=mysql
Character-set-server=utf8 # Set the server 's character set to prevent Chinese garbled characters
# Disabling Symbolic-links isrecommended to prevent assorted security risks
Symbolic-links=0
[Mysqld_safe]
Log-error=/usr/local/mysql/log/mysqld.log # Note that the log directory should be created manually here
Pid-file=/usr/local/mysql/mysqld.pid
Then execute the database initialization script file:
The arguments following the./scripts/mysql_install_db--defaults-file=my.cnf # represent the my.cnf defined using the previous step to initialize the database.
Wait a few seconds to see the data catalog search added MySQL catalogue and other files. At this point mysql MySQL is not a form of service and cannot be used service Xxx start ./bin/mysqld_safe &,
Note: Manually start MySQL commands: ./bin/mysqld_safe & As for why use mysqld_safe Span style= "font-family: Song Body", you can check the reasons.
manual stop mysql Span style= "font-family: Arial" > command: ./bin/mysqladmin  shutdown # note, try not to use localhost is used for system reasons. localhost You will be prompted to connect mysql
manually stop mysql for the second command:pkill mysql # kills all names that contain the The process of c10>mysql, neat :-D
other Linux under MySQL practical Commands I'll have some behind me.
"Register MySQL Service for the system "
if you want to MySQL started as a service, or set MySQL The following steps are required to start the boot.
Support-files mysql.server Copy to /etc/rc.d/init.d/ mysql (if you don't suspect This name is longer, you can not rename :-D , file name is the name of the service ).
This is where you can use service MySQL start to start MySQL (If you accidentally started it manually in the previous step MySQL , this step will prompt MySQL has been started).
Of course, the corresponding other commands also have service mysql stop/restart/status wait
the Settings MySQL Boot up "
at this MySQL has been registered as a service, if you need to start the boot, and then need two steps.
first the MySQL To join the boot startup list:
Chkconfig --add MySQL
Then set it to boot up:
Chkconfig MySQL on
this MySQL it will boot up.
If you need to turn off boot, you can:
Chkconfig MySQL off
View MySQL whether to start the boot:
Chkconfig--list MySQL
View MySQL listens on the listening port (default is 3306 ):
Netstat -lt | grep MySQL
" MySQL user name, remote login Settings "
How to install and start the above MySQL , MySQL after the initial installation, you also need to set up user name, password, and remote login and so on.
MySQL by default, only Root user, and the password is blank, this machine is not allowed to log on to other machines. If you want to set a password to root and allow it to telnet, you need to do so.
First in MySQL installation of machine login MySQL :
MySQL -uroot -h127.0.0.1
Then execute the following command:
Grant all privilegeson * to [e-mail protected] ' % ' identified by ' 12345678 ';
If you do not need to set a password, the following identified by ' 12345678 ' can be omitted.
in this way, you can use the Navicat and other tools to connect remotely MySQL , and further operations are performed.
Install MySQL "Practice Edition" under Linux