Install the MySQL database on linux, set the user password, and log on to MySQL and linuxmysql.
Install the MySQL database on the newly installed Centos system.
<P> <a href = "http://www.cnblogs.com/tijun/"> Ti Jun blog original </a> </p>
> Ti Jun blog original http://www.cnblogs.com/tijun/ <
Step 1: Check whether MySQL is installed. If MySQL is installed, uninstall it.
[root@ltt5 ~]# rpm -e mysqlerror: package mysql is not installed
If you do this in one step, you do not need to execute the check command in advance. You can directly execute the uninstall command. If you delete the command, you don't have to worry about it.
Step 2: Install
[root@ltt5 ~]# yum -y install mysql mysql-server mysql-devel.........Complete!
If complete is displayed, the installation is successful.
> Ti Jun blog original http://www.cnblogs.com/tijun/ <
Step 3: enable the Service
[root@ltt5 ~]# service mysqld startInitializing MySQL database: Installing MySQL system tables...OKFilling help tables...OKTo start mysqld at boot time you have to copysupport-files/mysql.server to the right place for your systemPLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !To do so, start the server, then issue the following commands:/usr/bin/mysqladmin -u root password 'new-password'/usr/bin/mysqladmin -u root -h ltt5.bg.cn password 'new-password'Alternatively you can run:/usr/bin/mysql_secure_installationwhich will also give you the option of removing the testdatabases and anonymous user created by default. This isstrongly recommended for production servers.See the manual for more instructions.You can start the MySQL daemon with:cd /usr ; /usr/bin/mysqld_safe &You can test the MySQL daemon with mysql-test-run.plcd /usr/mysql-test ; perl mysql-test-run.plPlease report any problems with the /usr/bin/mysqlbug script! [ OK ]Starting mysqld: [ OK ]
Step 4: Set startup
[root@ltt5 ~]# chkconfig mysqld on[root@ltt5 ~]# chkconfig --list mysqld mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
Step 5: initially set the login user and password
[root@ltt5 ~]# mysqladmin -u root password 'root'
Step 6: log on to the MySQL database
[root@ltt5 ~]# mysql -u root -pEnter password: Welcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 5Server version: 5.1.73 Source distributionCopyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
Enter the root password and press enter to log on.
Step 7: View help
mysql> help;For information about MySQL products and services, visit: http://www.mysql.com/For developer information, including the MySQL Reference Manual, visit: http://dev.mysql.com/To buy MySQL Enterprise support, training, or other products, visit: https://shop.mysql.com/List of all MySQL commands:Note that all text commands must be first on line and end with ';'? (\?) Synonym for `help'.clear (\c) Clear the current input statement.connect (\r) Reconnect to the server. Optional arguments are db and host.delimiter (\d) Set statement delimiter.edit (\e) Edit command with $EDITOR.ego (\G) Send command to mysql server, display result vertically.exit (\q) Exit mysql. Same as quit.go (\g) Send command to mysql server.help (\h) Display this help.nopager (\n) Disable pager, print to stdout.notee (\t) Don't write into outfile.pager (\P) Set PAGER [to_pager]. Print the query results via PAGER.print (\p) Print current command.prompt (\R) Change your mysql prompt.quit (\q) Quit mysql.rehash (\#) Rebuild completion hash.source (\.) Execute an SQL script file. Takes a file name as an argument.status (\s) Get status information from the server.system (\!) Execute a system shell command.tee (\T) Set outfile [to_outfile]. Append everything into given outfile.use (\u) Use another database. Takes database name as argument.charset (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.warnings (\W) Show warnings after every statement.nowarning (\w) Don't show warnings after every statement.For server side help, type 'help contents'
Step 8: view the original database of the system
mysql> show databases -> ;+--------------------+| Database |+--------------------+| information_schema || mysql || test |+--------------------+3 rows in set (0.00 sec)
Step 9: Create a database
<P> <a href = "http://www.cnblogs.com/tijun/"> Ti Jun blog original </a> </p>
mysql> create database hive -> ;Query OK, 1 row affected (0.00 sec)mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || hive || mysql || test |+--------------------+4 rows in set (0.00 sec)
Step 10: Exit
mysql> quitBye
So far, the installation and simple settings of MySQL Data have been introduced.
> Ti Jun blog original http://www.cnblogs.com/tijun/ <
<P> <a href = "http://www.cnblogs.com/tijun/"> Ti Jun blog original </a> </p>