<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="es">
	<id>http://wiki.cabal.mx/index.php?action=history&amp;feed=atom&amp;title=Curso_de_Programaci%C3%B3n_en_Python%2FMySQL-3</id>
	<title>Curso de Programación en Python/MySQL-3 - Historial de revisiones</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.cabal.mx/index.php?action=history&amp;feed=atom&amp;title=Curso_de_Programaci%C3%B3n_en_Python%2FMySQL-3"/>
	<link rel="alternate" type="text/html" href="http://wiki.cabal.mx/index.php?title=Curso_de_Programaci%C3%B3n_en_Python/MySQL-3&amp;action=history"/>
	<updated>2026-04-11T18:04:09Z</updated>
	<subtitle>Historial de revisiones para esta página en el wiki</subtitle>
	<generator>MediaWiki 1.32.1</generator>
	<entry>
		<id>http://wiki.cabal.mx/index.php?title=Curso_de_Programaci%C3%B3n_en_Python/MySQL-3&amp;diff=119637&amp;oldid=prev</id>
		<title>Rrc en 03:12 21 dic 2015</title>
		<link rel="alternate" type="text/html" href="http://wiki.cabal.mx/index.php?title=Curso_de_Programaci%C3%B3n_en_Python/MySQL-3&amp;diff=119637&amp;oldid=prev"/>
		<updated>2015-12-21T03:12:40Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Página nueva&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
* [[:#MySQL-3 | MySQL-3.py]]&lt;br /&gt;
&lt;br /&gt;
== MySQL-3.py ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;python&amp;quot; line=&amp;quot;GESHI_FANCY_LINE_NUMBERS&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#!/usr/bin/python&lt;br /&gt;
#-*-coding: utf-8 -*-&lt;br /&gt;
&lt;br /&gt;
import mysql.connector&lt;br /&gt;
from mysql.connector import errorcode&lt;br /&gt;
&lt;br /&gt;
config = {&lt;br /&gt;
  &amp;#039;user&amp;#039;: &amp;#039;PythonClase&amp;#039;,&lt;br /&gt;
  &amp;#039;password&amp;#039;: &amp;#039;Py800se&amp;#039;,&lt;br /&gt;
  &amp;#039;host&amp;#039;: &amp;#039;127.0.0.1&amp;#039;,&lt;br /&gt;
  &amp;#039;database&amp;#039;: &amp;#039;PythonClase&amp;#039;,&lt;br /&gt;
  &amp;#039;raise_on_warnings&amp;#039;: True,&lt;br /&gt;
  &amp;#039;unix_socket&amp;#039;: &amp;#039;/var/lib/mysql/mysql.sock&amp;#039;&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
try:&lt;br /&gt;
  Conn = mysql.connector.connect(**config)&lt;br /&gt;
except mysql.connector.Error as err:&lt;br /&gt;
  if err.errno == errorcode.ER_ACCESS_DENIED_ERROR:&lt;br /&gt;
    print( &amp;quot;UsuarioNombre o Contraseña incorrecto&amp;quot; )&lt;br /&gt;
  elif err.errno == errorcode.ER_BAD_DB_ERROR:&lt;br /&gt;
    print( &amp;quot;Base de Datos no existe&amp;quot; )&lt;br /&gt;
  else:&lt;br /&gt;
    print( err )&lt;br /&gt;
&lt;br /&gt;
Cursor = Conn.cursor()   &lt;br /&gt;
&lt;br /&gt;
Query = &amp;quot;CREATE TABLE TablaDePrueba( id int NOT NULL AUTO_INCREMENT, \&lt;br /&gt;
                             CampoDePueba varchar(75), \&lt;br /&gt;
                             PRIMARY KEY(id))&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
Cursor.execute( Query )&lt;br /&gt;
&lt;br /&gt;
Conn.commit()&lt;br /&gt;
&lt;br /&gt;
Conn.close()&lt;br /&gt;
&lt;br /&gt;
print( &amp;quot;Mira en to carpeta para ver que tienen ustedes una table nueva&amp;quot; )&lt;br /&gt;
print( &amp;quot;el mysql console para verlo&amp;quot; );&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Resultado ===&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[rrc@Pridd PythonClase]$ ./MySQL-3.py &lt;br /&gt;
Mira en to carpeta para ver que tienen ustedes una table nueva&lt;br /&gt;
el mysql console para verlo&lt;br /&gt;
&lt;br /&gt;
[rrc@Pridd PythonClase]$ mysql -pPy800se -u PythonClase&lt;br /&gt;
Welcome to the MariaDB monitor.  Commands end with ; or \g.&lt;br /&gt;
Your MariaDB connection id is 13&lt;br /&gt;
Server version: 10.0.22-MariaDB Mageia MariaDB Server&lt;br /&gt;
&lt;br /&gt;
Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.&lt;br /&gt;
&lt;br /&gt;
Type &amp;#039;help;&amp;#039; or &amp;#039;\h&amp;#039; for help. Type &amp;#039;\c&amp;#039; to clear the current input statement.&lt;br /&gt;
&lt;br /&gt;
MariaDB [(none)]&amp;gt; use PythonClase;&lt;br /&gt;
Database changed&lt;br /&gt;
MariaDB [PythonClase]&amp;gt; show tables;&lt;br /&gt;
+-----------------------+&lt;br /&gt;
| Tables_in_PythonClase |&lt;br /&gt;
+-----------------------+&lt;br /&gt;
| TablaDePrueba         |&lt;br /&gt;
+-----------------------+&lt;br /&gt;
1 row in set (0.00 sec)&lt;br /&gt;
&lt;br /&gt;
MariaDB [PythonClase]&amp;gt; &lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Rrc</name></author>
		
	</entry>
</feed>