Linux mysql uninstallation, installation, test process, linuxmysql

Source: Internet
Author: User

Linux mysql uninstallation, installation, test process, linuxmysql
Mysql uninstall
Yum remove mysql-server mysql-libs compat-mysql51
Rm-rf/var/lib/mysql
Rm/etc/my. cnf
Check whether there is any mysql software:
Rpm-qa | grep mysql
If yes, continue to delete


Install Mysql
1> if there is no installation package locally, you can use the yum command to download it.
# Yum-y install mysql-server
# Yum-y install php-mysql
2> after installation, MySQL is automatically started. By default, there is no user name or password, and a new password is set.
#/Usr/bin/mysqladmin-u root password 'aaaaa'
[Root @ luozhonghua ~] #/Usr/bin/mysqladmin-u root password 'aaaaa'
/Usr/bin/mysqladmin: connect to server at 'localhost' failed
Error: 'Can't connect to local MySQL server through socket '/var/lib/mysql. sock' (2 )'
Check that mysqld is running and that the socket: '/var/lib/mysql. sock' exists!
Solution:
2.1 "/etc/rc. d/init. d/mysqld status to check whether mysql has started
3.2 service mysqld start
3> log on to MySQL
> Mysql-u root-p
Enter password: 'aaaaa'


4> authorize connected hosts
# Grant select, insert, update, delete on *. * to root@192.168.1.101 identified by 'aaaaa'
Grant select, insert, update, delete on *. * to root@127.0.0.1 identified by 'aaaaa ';




5> change the default Character Set
# Cp my-medium.cnf/etc/my. cnf
Add default-character-set = utf8 under [client]
Add default-character-set = utf8 under [mysqld]
Find installation path
Rpm-qa | grep mysql
Rpm-ql package name
[Root @ luozhonghua charsets] # find/usr-name my-medium.cnf
/Usr/share/doc/mysql-server-5.1.73/my-medium.cnf
/Usr/share/mysql/my-medium.cnf.


#6> set mysql to boot automatically
# Vi/etc/rc. local
Add the following line
#/Usr/share/mysql. server start
7> restart MySQL
#/Etc/init. d/mysql restart
Service mysqld restart


8> test;


[Root @ luozhonghua ~] # Mysql-u root-p
Enter password:
Welcome to the MySQL monitor. Commands end with; or \ g.
Your MySQL connection id is 3
Server version: 5.1.73 Source distribution


Copyright (c) 2000,201 3, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its
Affiliates. Other names may be trademarks of their respective
Owners.


Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.


Mysql> create database xxx
->;
Query OK, 1 row affected (0.06 sec)


Mysql> ls
->;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th at corresponds to your MySQL server version for the right syntax to use near 'LS' at line 1
Mysql> show databases
->;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Test |
| Xxx |
+ -------------------- +
4 rows in set (0.06 sec)


Mysql> use xxx;
Database changed
Mysql> show database
->;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th at corresponds to your MySQL server version for the right syntax to use near 'database' at line 1
Mysql> show databases;
+ -------------------- +
| Database |
+ -------------------- +
| Information_schema |
| Mysql |
| Test |
| Xxx |
+ -------------------- +
4 rows in set (0.01 sec)


Mysql> use xxx;
Database changed
Mysql> create table test (
-> Int id not null,
-> Varchar (20) name null );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th at corresponds to your MySQL server version for the right syntax to use near 'int id not null,
Varchar (20) name null) 'at line 2
Mysql> show tables;
Empty set (0.00 sec)


Mysql> create table dbtest (
-> Id int,
-> Name varchar );
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th at corresponds to your MySQL server version for the right syntax to use near ')' at line 3
Mysql> create table dbtest (
-> Id int,
-> Name varchar (10 ));
Query OK, 0 rows affected (0.07 sec)


Mysql> show tables;
+ --------------- +
| Tables_in_xxx |
+ --------------- +
| Dbtest |
+ --------------- +
1 row in set (0.01 sec)


Mysql> drop table xxx;
ERROR 1051 (42S02): Unknown table 'xxx'
Mysql> drop table dbtest;
Query OK, 0 rows affected (0.00 sec)


Mysql> ls
->;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual th at corresponds to your MySQL server version for the right syntax to use near 'LS' at line 1
Mysql> show tables;
Empty set (0.00 sec)


Mysql>
In linux, how can I uninstall mysql and uninstall commands and procedures? Thank you!

Uninstall using yum to automatically resolve the dependency package. yum remove mysql
 
In LINUX, how does one reinstall MYSQL and uninstall it?

Recompile and install it. You can specify the original directory or a new installation directory. If you used to install mysql with an RPM package, uninstall the rpm-e installation package name. You can decompress the package directly on the official website without compiling it.

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.